Recent Posts

Pages: [1] 2 3 ... 10
1
H.264/AVC / Re: x264 input buffering
« Last post by Aries86 on June 18, 2013, 09:18:37 PM »
Its really amazing and nice.Thanx for sharing it.
2
General Discussion / Live555 is not sending the frame
« Last post by Edimartin on June 18, 2013, 12:04:55 PM »
Hi. I need use live555 to send a x264 frame from my Camera to the VLC.
Is this the right forum to ask this?


I use openCV to get the camera frame and convert from BGR to YUV.
I use x264 to convert the frame.
Butt the live555 is not sending the frame.


I create a RTSPServer

Code: [Select]
lookupServerMediaSession(char const* streamName){
//
//lookUp for the session with the name
ServerMediaSession* sms = RTSPServer::lookupServerMediaSession(streamName);
if (!sms){
//create the session if this is't exist
sms = ServerMediaSession::createNew(envir(), streamName,"send server","sending the camera");
if (sms){
//add a subsession
sms->addSubsession( CameraServerMediaSubsession::createNew(envir(),true) );
}
}
return sms;
 }


The subsession create a FramedSource and VideoRTPSink

Code: [Select]
FramedSource* CameraServerMediaSubsession::createNewStreamSource(unsigned clientSessionId,
      unsigned& estBitrate)
{
//
return new CameraStream(this->envir());
}
RTPSink* CameraServerMediaSubsession::createNewRTPSink(Groupsock* rtpGroupsock,
    unsigned char rtpPayloadTypeIfDynamic,
    FramedSource* inputSource){
//
return CameraVideoRTPSink::createNew(this->envir(),
rtpGroupsock,
rtpPayloadTypeIfDynamic);
}


I write the CameraStream (FramedSource) using this example:

http://www.live555.com/liveMedia/doxygen/html/DeviceSource_8cpp-source.html

Here is the code.

Code: [Select]
void CameraStream::doGetNextFrame(){
//
if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet

//get the size of the x264 frame
unsigned newFrameSize = cameraSize;
//create the frame
u_int8_t* newFrameDataStart = new u_int8_t[newFrameSize];


//copy the frame data
memcpy(newFrameDataStart,camera,cameraSize);
 
//This I found in the example
if (newFrameSize > fMaxSize) {
fFrameSize = fMaxSize;
fNumTruncatedBytes = newFrameSize - fMaxSize;
} else {
fFrameSize = newFrameSize;
}

//move the frame to FTO
memmove(fTo, newFrameDataStart, fFrameSize);
 
//Inform the reader it's now avaliable
FramedSource::afterGetting(this);
}


The server run the doGetNextFrame function in CameraStream. But the frame is not sent.

Do someone know how can I set the live555 to send the frame?
3
General Discussion / devise charger question
« Last post by base1268 on June 15, 2013, 04:16:10 AM »
Can anyone please tell me if I'm ok to do the following:

I have a set of Motorcycle BT comms... they come from china... surprise suprise...  :)

Great units... work brilliantly... however they cut back cost by supplying el cheapo usb chargers and one has given up already.

I note that they are 5 volt 500 milliamp chargers.

So my question is can I safely use my sony smartphone charger in place of the busted one...? The only difference is the output is 850 milliamp.

It's been a while since physics at school but as I recall the slight increase in ma output will only mean it charges a little faster cos amps is the measure of flow rate if I'm not mistaken...?

The BT units have a red led light that comes on when charging and goes out when the battery is full.

I've already tried using it and it worked... but obviously I don't want to corrupt the battery by using it again before making sure that charging it at the faster 850ma rate aint gonna burn out the battery.

I've tried searching everywhere to find the spec of the battery in the unit but without any luck so we can only guess as to what it's made of... it holds charge well and gives me a good 6 hours of talk time.

Nick
4
H.264/AVC / Re: Get the frame encoded to send
« Last post by Edimartin on June 13, 2013, 10:22:30 AM »
Hi  J_Darnley. Thanks to your reply.

I figure out the problem. My frame was cleaned.
Now I copy the data from the mata to x264 picture using this code.

Code: [Select]
unsigned int widthXheight = frameDefault.total();//matYUV total is diferent from frameDefault
memcpy(pic_in.img.plane[0], matYUV.data, widthXheight);
memcpy(pic_in.img.plane[1], matYUV.data + widthXheight, (widthXheight / 4));
memcpy(pic_in.img.plane[2], matYUV.data + widthXheight + (widthXheight / 4), (widthXheight / 4));

Now the x264 640x480 frame have 12000 bytes (keyframed).
5
H.264/AVC / Re: Get the frame encoded to send
« Last post by J_Darnley on June 13, 2013, 12:42:34 AM »
I test with X264CSP_RGB and x264 return a error message.

This error message is...?  I will guess it is because you tried to force High Profile which does not support anything but YUV 4:2:0

Quote
the encode function return a int with value == 850 (the first time). After this the i_frame_size is 120.

Is this the frame size?
How can I get the frame data to send?

Yes and it's in the nal pointer.
6
H.264/AVC / Re: x264 crashes in x264_encoder_open( &param )
« Last post by J_Darnley on June 13, 2013, 12:35:48 AM »
1ยบ I compile latest x264 on minGW (version 125) and the compiler can't find "x264_encoder_open_125()";

If the compiler can't find this when linking then you have mismatched library and header files.  Remove any x264 you have installed then get the latest source which will provide 133 and then compile that.  Do not use Edimartin's configure line.
7
H.264/AVC / Get the frame encoded to send
« Last post by Edimartin on June 12, 2013, 12:48:25 PM »
Hi. I need to encode a RGB frame to x264 and send using live 555.
I have no idea how x264 works and I try encode an YUV12 image.

I try with a opencv camera:

Code: [Select]
int widthXheight = width * height;
    x264_nal_t* pNals = NULL;

    x264_param_default(&param);
    param.i_width = width;
    param.i_height = height;
    param.i_bframe = 3;
param.i_fps_num = fps;
    param.i_fps_den = 1;
    param.b_vfr_input = 0;
    param.i_keyint_max = 250;
    param.rc.i_bitrate = 1500;
    param.i_scenecut_threshold = 40;
    param.i_level_idc = 51;
unsigned long int frames=0u;

param.rc.i_rc_method = X264_RC_CRF;
param.rc.f_rf_constant = 25;
param.rc.f_rf_constant_max = 35;

    x264_param_apply_profile(&param, "high");

    h = x264_encoder_open( &param );

//Cria a imagem x264
x264_picture_init( &pic_in );
x264_picture_alloc(&pic_in, X264_CSP_YV12, width, height);
pic_in.img.i_csp = X264_CSP_YV12;
    pic_in.img.i_plane = 3;

I test with X264CSP_RGB and x264 return a error message.

Then I convert my Image with openCV in this source

Code: [Select]
camYUVData[frameDefault.total()*3u]=0u;
//cria a matriz para o YUV
cv::Mat matYUV(frameDefault.size(),CV_8UC3,camYUVData);
//converte de RGB para YUV12
cv::cvtColor(frameRGBA, matYUV, CV_RGB2YUV_YV12);

unsigned int widthXheight = frameDefault.total();
memcpy(pic_in.img.plane[0], camYUVData, widthXheight);
memcpy(pic_in.img.plane[1], camYUVData + widthXheight, widthXheight >> 2);
memcpy(pic_in.img.plane[2], camYUVData + widthXheight + (widthXheight >> 2), widthXheight >> 2);

pic_in.i_type = X264_TYPE_KEYFRAME;

//comprime usando x264
i_frame_size = x264_encoder_encode( h, &nal, &i_nal, &pic_in, &pic_out );
printf("  i_frame_size == %u"
,i_frame_size
);

frames++;

the encode function return a int with value == 850 (the first time). After this the i_frame_size is 120.

Is this the frame size?
How can I get the frame data to send?
8
Jacket,

Can't comment on suppressing the streams.

To debug a preset run the job in AnotherGUI and the last command is in textbox above the jobs list.
Make a new .bat file, copy the "Last Command" content into .bat file, add "PAUSE" to a new line and run the bat file.

Priit
9
I'm trying to use your "Another GUI" interface to convert some 4k motion jpeg video from the Canon 1DC to 1080p prores. I think that the encode is failing through another gui because the video has an unsupported data stream. The Command works through ffmpeg in the command prompt, but not in another gui.

This is the modified script I'm using in another gui.

-i "<FullSourceFileName>"-y -map 0 -map -0:d -vcodec prores -profile:v 3 -s 1920x1013 -acodec pcm_s16le -ar 48000 -ac 2 "<C:\Users\admin\Desktop\render><OutputFileName>.mov"

I'm using the "-map" function to disable the data stream. I read about the -imap function here

Also is there a way to keep the command prompt from auto closing after an encode/failed encode? for debbuging of my presets?

Thanks
jaket
10
H.264/AVC / Re: Encoding for crisp 720p on Youtube?
« Last post by Yumi on June 11, 2013, 09:36:59 PM »
I haven't seen your Youtube link yet, but I'd say it's best if you can supply it a native 1280x720 video so that you take the job of resizing out of the hands of Youtube.
By "squidges" I presume you mean a messed up aspect ratio?  If so, just add black borders on the side (that is downscale 1280x1024 -> 900x720 and pad sides to get 1280x720).  The resize itself, though, may cause some bluriness, but you've said that it's readable so I presume it's not a big problem.

It's best if you could capture at 720p, so that you don't need to do any resizing.  Alternatively, if you don't need the full screen, you could consider cropping to 1280x720.

Alternatively, you might consider upscaling to 1080p, which may cause bluriness (due to upscaling) but is unlikely to affect readability.  Or you could just pad the video to 1080p, which should preserve the sharpness but means that you've got annoying black borders around the whole video.
Pages: [1] 2 3 ... 10