Opened 5 years ago

#3697 new defect

H264/MPEGTS avg_frame_rate inconsistencies

Reported by: bog Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
When transcoding h264 in mp4 with non-whole frame rates to mpegts and back, the avg_frame_rate and packet duration is altered. This can be problematic when concatenating multiple mp4s with the concat protocol with the same settings because the avg_frame_rate is not normalized.

How to reproduce:
I'm working with this ffmpeg:

ffmpeg version N-63724-g5766543 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  3 2014 07:41:35 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  configuration: --enable-gpl --enable-postproc --disable-debug --enable-libmp3lame --enable-libfdk_aac --enable-pthreads --enable-libx264 --enable-libvpx --enable-nonfree --enable-libass --enable-libfreetype --enable-static --extra-libs=-ldl

The file below is 23.976fps content. avg_frame_rate reported by ffprobe is 2997/125. The pkt_duration_time is 0.041708.

ffmpeg -i -c copy -bsf:v h264_mp4toannexb -f mpegts test.ts
ffprobe -show_streams -select_streams v:0 test.ts 2>/dev/null | grep avg_frame_rate

ffprobe outputs: avg_frame_rate=24000/1001. I think this change is ok, but I wanted to include it. The video pkt_duration_time is now 0.041700.

Next, we transcode the video back to mp4:

ffmpeg -i test.ts -c copy -bsf:a aac_adtstoasc test.mp4
ffprobe -show_streams -select_streams v:0 test.mp4 2>/dev/null | grep avg_frame_rate

ffprobe outputs: avg_frame_rate=10980000/457957. The video pkt_duration_time is still 0.041700.

The avg_frame_rate is different for each file I bring through this process.

Change History (0)

Note: See TracTickets for help on using tickets.