[Libav-user] examples/demuxing.c not working properly

Stephane Debusne stephane.debusne at gmail.com
Mon Oct 15 11:37:15 CEST 2012


Le 15/10/2012 11:26, Chandranath Bhattacharyya a écrit :
>
> Hi All,
>
> I downloaded windows ffmpeg build from 
> http://ffmpeg.zeranoe.com/builds/. The build downloaded is 
> ffmpeg-20121009-git-f3f35f7-win32-shared.7z & 
> ffmpeg-20121009-git-f3f35f7-win32-dev.7z.
>
> I built "examples/demuxing.c" using Visual Studio 10 on windows. 
> However, it's not working. When invoked with command line: <exename> 
> output.mp4, it's exiting with the following errors:
>
> [mp4 @ 00582ea0] Encoder did not produce proper pts, making some up.
>
> [mp4 @ 00582ea0] pts (0) < dts (1) in stream 0
>
> Error while writing video frame
>
> I figured out that av_interleaved_write_frame is failing because a 
> call to avcodec_encode_video2 is not changing 
> AVCodecContext::coded_frames->pts. It's always 0, and hence 
> AVPacket.pts is 0. However the call to avcodec_encode_video2 is 
> increasing the AVPacket.dts value from -2, -1, 0, 1. So in 4^th call 
> to av_interleaved_write_frame, AVPacket.pts < AVPacket.dts causing the 
> issue.
>
> I made some code changes to ensure that pts > dts, and then the file 
> was written. However when opened in Windows Media Player Classic, the 
> file is showing a frame rate of 12800.
>
> I was using following. Modified STREAM_DURATION to 10.0 from 200.0.
>
> #defineSTREAM_DURATION   10.0
>
> #defineSTREAM_FRAME_RATE 25 /* 25 images/s */
>
> #defineSTREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE))
>
> With these parameters,AVStream::codec->time_base = { num: 1, den: 25}, 
> but just after call toavformat_write_header, the AVStream::time_base = 
> { num: 1, den: 12800 }.
>
> What's going wrong?AVStream::time_base.den = 12800; seems to be wrong 
> data. Other than fixing some compilation errors, I did not modify 
> anything else in examples/demuxing.c.
>
> Regards,
>
> Chandranath
>


It seems i've got the same troubles since the 3 last zeranoe packages. 
Previous ones were ok, but last 3 gives 12800 fps frame for .mp4 rate 
and i've got some others troubles like that with other encoders / 
containers...
So i'm very interested in an answer to this question too !
And as a bonus question : Should be set .pts for each frame to a correct 
value for the encoder and for the container or can we keep AV_NOPTS_VALUE ?

regards

Stephane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121015/5b3b863d/attachment.html>


More information about the Libav-user mailing list