Opened 3 years ago

Last modified 2 years ago

#4955 new defect

Converting H.264 Video in MPEG-TS container doubles tbc

Reported by: nixscripter Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: h264 mpegts
Cc: jsantiago@fastmail.us Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When converting video to H.264 in an MPEG-TS container, something strange happens. FFmpeg claims that the output has the same framerate (and tbc and tbn) as the input, but according to FFprobe, the calculated tbc is doubled. This is regardless of vsync or rate (-r) option.

ffplay seems able to deal with it, but other players don't play it back correctly, and it is those other players that led me to this issue.

Attachments (3)

mts_conv_x2_fr_input.mpg (1.3 MB) - added by nixscripter 3 years ago.
Input Example
mts_conv_x2_fr_output.mts (785.6 KB) - added by nixscripter 3 years ago.
Output of Converting Example
mts_conv_x2_fr_log.txt (65.7 KB) - added by nixscripter 3 years ago.
Log Level 99 Output of Converting Example

Change History (11)

Changed 3 years ago by nixscripter

Input Example

Changed 3 years ago by nixscripter

Output of Converting Example

Changed 3 years ago by nixscripter

Log Level 99 Output of Converting Example

comment:1 in reply to: ↑ description Changed 3 years ago by nixscripter

To clarify, other players (such as mplayer) playback the video at twice the speed of the audio, i.e. at the calculated tbc rate.

comment:2 follow-up: Changed 3 years ago by cehoyos

  • Keywords h264 added

I wasn't able to find another player that fails for the output file you uploaded: Isn't this a bug in MPlayer?

comment:3 in reply to: ↑ 2 Changed 3 years ago by nixscripter

Replying to cehoyos:

I wasn't able to find another player that fails for the output file you uploaded: Isn't this a bug in MPlayer?

It may very well be. However, I wonder if the bug is being triggered by an encoder output that is still unexpected.

As I previously noted, if you ffprobe the output file, you get:

Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 360x240 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

When it was encoded, ffmpeg thought it was generating a file that would be 29.97:

Output #0, mpegts, to 'mts_conv_x2_fr_output.mts':
  Metadata:
    encoder         : Lavf57.10.100
    Stream #0:0, 0, 1/90000: Video: h264 (libx264), -1 reference frame, yuv420p(center), 360x240 [SAR 32:27 DAR 16:9], 1001/30000, q=-1--1, 29.97 fps, 90k tbn, 29.97 tbc

Since even ffprobe read the file and computed an incorrect AVCodecContext time base based on something in the stream, doesn't that indicate something odd happened during encoding? Or is that calculation by ffprobe considered completely arbitrary and lacking any defined behavior?

If the latter is the case, then you can close this bug.

comment:4 Changed 2 years ago by jlsantiago0

  • Cc jsantiago@fastmail.us added

comment:5 Changed 2 years ago by cehoyos

comment:6 Changed 2 years ago by cehoyos

  • Keywords mpegts added

comment:7 Changed 2 years ago by cehoyos

  • Keywords mpegps added

comment:8 Changed 2 years ago by cehoyos

  • Keywords mpegps removed
Note: See TracTickets for help on using tickets.