incorrect dts when encoding in ffmpeg

560 views
Skip to first unread message

YIRAN LI

unread,
Sep 5, 2013, 7:53:10 AM9/5/13
to webm-d...@webmproject.org
Hi friend,

I'm writing an application using ffmpeg libs on Windows (with --enable-libvpx).

Today I found something strange. In this application we call avcodec_encode_video2 first to get a AVPacket instance and write this packet into file with av_write_frame

I found that the pst values of returned packet is correct, they are 1, 2, 3, 4 .... (in input video stream time base). but dts values are always 0. I transferred the pts values to corresponding values (in output video stream time base) and keep 0 for dts. Then the webm files generated in this way can't be played correctly in ffplay (reported warnings of 0 DTS).

If I set all dts values to AV_NOPTS_VALUE, then the output video is perfect.

In fact I found that if use avcodec_encode_video to encode, then dts are AV_NOPTS_VALUE.

I'm building from latest libvpx code, could anyone help to check if it's a libvpx bug?

Great thanks!

James Zern

unread,
Sep 10, 2013, 1:38:42 AM9/10/13
to WebM Discussion
On Thu, Sep 5, 2013 at 4:53 AM, YIRAN LI <mrfun...@gmail.com> wrote:
> Hi friend,
>
> I'm writing an application using ffmpeg libs on Windows (with
> --enable-libvpx).
>
> Today I found something strange. In this application we call
> avcodec_encode_video2 first to get a AVPacket instance and write this packet
> into file with av_write_frame
>
> I found that the pst values of returned packet is correct, they are 1, 2, 3,
> 4 .... (in input video stream time base). but dts values are always 0. I
> transferred the pts values to corresponding values (in output video stream
> time base) and keep 0 for dts. Then the webm files generated in this way
> can't be played correctly in ffplay (reported warnings of 0 DTS).

These values are both set in the wrapper, libvpxenc.c [1], to the same
value. The wrapper has always forwarded the pts from the input frame.

>
> If I set all dts values to AV_NOPTS_VALUE, then the output video is perfect.
>
> In fact I found that if use avcodec_encode_video to encode, then dts are
> AV_NOPTS_VALUE.
>
> I'm building from latest libvpx code, could anyone help to check if it's a
> libvpx bug?
>
> Great thanks!
>

[1] http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/libvpxenc.c;h=5f3c32a59803335cc9c4353692c04d915b9d4559;hb=HEAD#l493
Reply all
Reply to author
Forward
0 new messages