[FFmpeg-trac] #10348(undetermined:open): Invalid B-frames timestamps importing .h264 or .hevc stream

FFmpeg trac at avcodec.org
Wed May 10 01:14:01 EEST 2023


#10348: Invalid B-frames timestamps importing .h264 or .hevc stream
-------------------------------------+-------------------------------------
             Reporter:  slydiman     |                    Owner:  (none)
                 Type:  defect       |                   Status:  open
             Priority:  important    |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:  frames       |               Blocked By:
  timestamp h264 hevc                |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Description changed by slydiman:

Old description:

> ffmpeg calculates invalid timestamps importing .h264 or .hevc stream with
> B-frames. Note the video decoder will reorder frames and fix the frames
> timestamps. So it is possible to get the valid file only reencoding the
> video stream. It is impossible to mux the valid file without reencoding.
> Note the invalid file may be played correctly if the video decoder is
> smart enough (MediaPlayerClassic, VLC, etc.). You must playback the
> invalid MP4 in Google Chrome or QuickTime to see the issue.
> How to reproduce:
> {{{
> % ffmpeg -i b-frames.h264 -c copy invalid.mp4
> % ffmpeg -i b-frames.h264 -c h264 valid.mp4
> ffmpeg any version including 6.0
> }}}
> Samples:
> http://slydiman.me/ffmpeg/b-frames.h264
> http://slydiman.me/ffmpeg/invalid.mp4
> http://slydiman.me/ffmpeg/valid.mp4

New description:

 ffmpeg calculates invalid timestamps importing .h264 or .hevc stream with
 B-frames. Note the video decoder will reorder frames and fix the frames
 timestamps. So it is possible to get the valid file only reencoding the
 video stream. It is impossible to mux the valid file without reencoding.
 Note the invalid file may be played correctly if the video decoder is
 smart enough (MediaPlayerClassic, VLC, etc.). You must playback the
 invalid H264 MP4 in Google Chrome or QuickTime to see the issue. I tested
 invalid HEVC MP4 in Adobe Premiere Pro 2022.

 How to reproduce (latest ffmpeg with Lavf60.5.100):
 {{{
 % ffmpeg -i b-frames.h264 -c copy h264_ffmpeg_copy_invalid.mp4
 % ffmpeg -i b-frames.h264 -c h264 h264_ffmpeg_reencode_valid.mp4
 % mp4box -add b-frames.h264 -new h264_mp4box_copy_valid.mp4

 % ffmpeg -i b-frames.hevc -c copy hevc_ffmpeg_copy_invalid.mp4
 % ffmpeg -i b-frames.hevc -c hevc hevc_ffmpeg_reencode_valid.mp4
 % mp4box -add b-frames.hevc -new hevc_mp4box_copy_valid.mp4
 }}}
 Samples:
 H264 1920x1080 50fps, High L4.2, yuv420p, recorded by SONY 7SM3
 http://slydiman.me/ffmpeg/b-frames.h264 (12MB)
 http://slydiman.me/ffmpeg/h264_ffmpeg_copy_invalid.mp4 (12MB)
 http://slydiman.me/ffmpeg/h264_ffmpeg_reencode_valid.mp4 (1.4MB)
 http://slydiman.me/ffmpeg/h264_mp4box_copy_valid.mp4 (12MB)

 HEVC 4K 23.976fps, Main 10 L5.0, yuv420p10le, recorded by SONY 7M4
 http://slydiman.me/ffmpeg/b-frames.hevc (14MB)
 http://slydiman.me/ffmpeg/hevc_ffmpeg_copy_invalid.mp4 (14MB)
 http://slydiman.me/ffmpeg/hevc_ffmpeg_reencode_valid.mp4 (1.1MB)
 http://slydiman.me/ffmpeg/hevc_mp4box_copy_valid.mp4 (14MB)

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10348#comment:10>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list