#11451: Ogg/Theora: Duplicate frames dropped when copying Theora streams
------------------------------------+------------------------------------
             Reporter:  Bernat      |                    Owner:  (none)
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------
Description changed by Bernat:

Old description:

> Hi. I'm working on Theora decoding support for Godot. Almost everything
> is working fine except for some kind of video streams.
>
> Theora encodes duplicate frames (frames identical to the previous one) as
> empty packets. Those empty packets seem to be discarded by FFmpeg when
> doing an operation that involves copying a Theora stream. It doesn't
> happen when encoding.
>
> Example:
> {{{
> ffmpeg -i input.ogv -c:v copy -a:n copy output.ogv
> }}}
>

> Although I'm not familiar with the code, I've searched the code for the
> cause and I think I found a possible regression in this commit:
> https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/18f24527eb4b520585e55f922cdbc234aa9f0f18
>
> The following line in the Ogg encoder is dropping empty packets:
> https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavformat/oggenc.c#l693
>
> Additionally, doing copies of copies of copies, increases gradually the
> size of the file and eventually throws this error:
>
> {{{
> [ogg @ 0x55c70ba998c0] Broken file, non-keyframe not correctly marked.
> }}}
>

> I hope this can be easily fixed. Thanks in advance. Cheers.

New description:

 Hi. I'm working on Theora decoding support for Godot. Almost everything is
 working fine except for some kind of video streams.

 Theora encodes duplicate frames (frames identical to the previous one) as
 empty packets. Those empty packets seem to be discarded by FFmpeg when
 doing an operation that involves copying a Theora stream. It doesn't
 happen when encoding.

 Example:
 {{{
 ffmpeg -i input.ogv -c:v copy -a:n copy output.ogv
 }}}

 Although I'm not familiar with the code, I've searched the code for the
 cause and I think I found a possible regression in this commit:
 
https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/18f24527eb4b520585e55f922cdbc234aa9f0f18

 The following line in the Ogg encoder is dropping empty packets:
 https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/HEAD:/libavformat/oggenc.c#l693

 Additionally, doing copies of copies of copies, increases gradually the
 size of the file and eventually throws this error:

 {{{
 [ogg @ 0x55c70ba998c0] Broken file, non-keyframe not correctly marked.
 }}}

 I use this command to create a test file for this issue:

 {{{
 ffmpeg -f lavfi -i color=white:320x240:d=1.5 -f lavfi -i
 color=red:320x240:d=0.1 -f lavfi -i color=cyan:320x240:d=1.5 -f lavfi -i
 color=green:320x240:d=0.1 -f lavfi -i color=yellow:320x240:d=3
 -filter_complex "[0:v] [1:v] [2:v] [3:v] [4:v] concat=n=5:v=1 [v]" -map
 "[v]" -framerate 50 -codec:v libtheora -qscale:v 5 -g:v 30 test.ogv
 }}}

 This command works correctly with FFmpeg 5.1.6 but with the latest master
 it suffers from the exact same issue this ticket describes.

 I hope this can be easily fixed. Thanks in advance. Cheers.

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11451#comment:4>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to