On Wed, Sep 7, 2011 at 4:13 PM, Denis <[email protected]> wrote: > Using this code > > AVCodec *pAVCodec= avcodec_find_encoder(CODEC_ID_MPEG4); > > if (!pAVCodec) qDebug() << "avcodec_find_encoder Error!!!"; > > else { > > AVCodecContext *pAVCodecContext= avcodec_alloc_context(); { > > pAVCodecContext->pix_fmt= PIX_FMT_YUV420P; > > pAVCodecContext->width= Width; > > pAVCodecContext->height= Height; > > pAVCodecContext->time_base.den= 25; > > pAVCodecContext->time_base.num= 1; > > int OutSize= avcodec_encode_video(pAVCodecContext, pOutBuffer, BYTEPIC, > pAVFrame); > > fwrite(pOutBuffer, 1, OutSize, FileOut); > > With this code I can produce a mpg file that I can see it with mplayer but > not with vlc. Vlc does not show a good error report, only this rows: > > denis@tomcat:~/C++/QtCamera/QtCamera-build-desktop$ cvlc a.mpeg > > VLC media player 1.1.3 The Luggage (revision exported) > > Blocked: call to unsetenv("DBUS_ACTIVATION_ADDRESS") > > Blocked: call to unsetenv("DBUS_ACTIVATION_BUS_TYPE") > > Warning: call to signal(13, 0x1) > > [0xb7004484] dummy interface: using the dummy interface module... > > ^C[0x91aae34] signals interface error: Caught Interrupt signal, exiting... > > denis@tomcat:~/C++/QtCamera/QtCamera-build-desktop$ > > What can I do to adjust my code in order to produce a mpg file for vlc? >
Maybe you need to write a header and/or trailer see http://www.ffmpeg.org/doxygen/trunk/avformat_8h.html#78d4e734fecb1d2385536e6dd5b7b9f5 and http://www.ffmpeg.org/doxygen/trunk/avformat_8h.html#7f14007e7dc8f481f054b21614dfec13 See also the encoding example (towards the end) where they manually write a trailer: http://www.ffmpeg.org/doxygen/trunk/encoding_8c-source.html#l00195 I'm not sure exactly which mpeg4 requires. Hope that helps, Matt > -- > > www.denisgottardello.it > > Skype: mrdebug > > Videosurveillance and home automation! > > http://www.denisgottardello.it/DomusBoss/DomusBossIndice.php > > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user > > _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
