Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Decoding h264 frames from RTP stream
9 octobre 2013, par Dmitry BakhtiyarovI am using live555 and ffmpeg libraries to get and decode RTP H264 stream from server; Video stream was encoded by ffmpeg, using Baseline profile and
x264_param_default_preset(m_params, "veryfast", "zerolatency")
I read this topic and add SPS and PPS data in the every frame, which I receive from network;
void ClientSink::NewFrameHandler(unsigned frameSize, unsigned numTruncatedBytes, timeval presentationTime, unsigned durationInMicroseconds) { ... EncodedFrame tmp; tmp.m_frame = std::vector
(m_tempBuffer.data(), m_tempBuffer.data() + frameSize); tmp.m_duration = durationInMicroseconds; tmp.m_pts = presentationTime; //Add SPS and PPS data into the frame; TODO: some devices may send SPS and PPs data already into frame; tmp.m_frame.insert(tmp.m_frame.begin(), m_spsPpsData.cbegin(), m_spsPpsData.cend()); emit newEncodedFrame( SharedEncodedFrame(tmp) ); m_frameCounter++; this->continuePlaying(); } And this frames I receive in the decoder.
bool H264Decoder::decodeFrame(SharedEncodedFrame orig_frame) { ... while(m_packet.size > 0) { int got_picture; int len = avcodec_decode_video2(m_decoderContext, m_picture, &got_picture, &m_packet); if (len < 0) { emit criticalError(QString("Decoding error")); return false; } if (got_picture) { std::vector
result; this->storePicture(result); if ( m_picture->format == AVPixelFormat::AV_PIX_FMT_YUV420P ) { //QImage img = QImage(result.data(), m_picture->width, m_picture->height, QImage::Format_RGB888); Frame_t result_rgb; if (!convert_yuv420p_to_rgb32(result, m_picture->width, m_picture->height, result_rgb)) { emit criticalError( QString("Failed to convert YUV420p image into rgb32; can't create QImage!")); return false; } unsigned char* copy_img = new unsigned char[result_rgb.size()]; //this needed because QImage shared buffer, which used, and it will crash, if i use this qimage after result_rgb deleting std::copy(result_rgb.cbegin(), result_rgb.cend(), copy_img); QImage img = QImage(copy_img, m_picture->width, m_picture->height, QImage::Format_RGB32, [](void* array) { delete[] array; }, copy_img); img.save(QString("123.bmp")); emit newDecodedFrame(img); } avcodec_decode_video2 decode frames without any error message, but decoded frames, after converting it (from yuv420p into rgb32) is invalid. Example of image available on this link
Do you have any ideas what I make wrong?
-
encoding XDCAM MXF with FFMPEG
9 octobre 2013, par magingaxTrying to encode XDCAM HD422 MXF with FFMPEG But can't know specific setting for encoder/format/mux Anyone can show me sample code or give some advice for that ?
-
Loss of frames results in a memory leak in the FFmpeg H.264 decoder
9 octobre 2013, par user2863509guys!
I am using FFmpeg library 'avcodec' in my VOIP-application for decoding streaming video in H.264 format. Video stream is transmitted over the network via RTP. I am using function avcodec_decode_video2() to decode H.264 frames received from the network.
I've used valgrind with tool 'massif' and found the memory leaks in the function avcodec_decode_video2().
I've discovered that the leaks occur when there is a loss of RTP packets before receiving the first INTRA frame (keyframe). The leak is directly proportional to the time which passes from the moment the first call avcodec_decode_video2() until arrival of the next INTRA frame (keyframe).
Question 1: Has anyone seen this behavior function avcodec_decode_video2()?
Question 2: There is a suspicion that the decoder allocates memory for data and does not release it after the arrival of good keyframe. How to bring back the memory in heap?
Thank all!
-
ffmpeg MAMP "dyld : Library not loaded" error
9 octobre 2013, par benedict_wI am using ffmpeg on Mac OSX 10.7.3 in MAMP through PHP's
exec()
command, I have an absolute path set to call ffmpeg, e.g./opt/local/bin/ffmpeg -i "/sample.avi"
But I receive the following error -
dyld: Library not loaded: /opt/local/lib/libjpeg.8.dylib Referenced from: /opt/local/lib/libopenjpeg.1.dylib Reason: Incompatible library version: libopenjpeg.1.dylib requires version 13.0.0 or later, but libJPEG.dylib provides version 12.0.0
N.B. ffmpeg was installed through Macports.
It works from the command line.
What to do?
EDIT
I've reopened this - originally thought
shell_exec()
solved the issue, but infact it should be called differently - and I didn't realise until investigating further today. Here is my code using shell_exec and still giving the error above:$cmd = '/opt/local/bin/ffmpeg -h'; $cmd = escapeshellcmd($cmd) . ' 2>&1'; $output = shell_exec($cmd); var_dump($output);
-
m3u8 on ios and safari, firefox
9 octobre 2013, par user2741735I'm implementing the HTTP Live Streaming protocol. I have successfully created .ts and .m3u8 files using ffmpeg and mediastreamsegmenter(using terminal) from IP Camera input. Now, when I play these files on ios using MPMoviePlayerViewController the m3u8 file doesn't play. Do I need to do some additional stuffs to play these files so that the simulator and browser could understand those file types.