Avidemux 2.7.1 (Win64) Bug: Displayed Time and/or frame types is wrong [solved]

Started by Steps, November 30, 2018, 07:20:00 PM

Previous topic - Next topic

Steps

I was wondering why some newly encoded videos do not start at time
"00:00:00.000" but "00:00:00.066" and double-checked that with ffprobe.

The frame at .066 is actually a B-Frame.

I exported the first frame displayed in Avidemux as BMP and did the same with ffmpeg.
They are binary identical. So it is the first frame.

So I'm almost certain that the displayed time in Avidemux is wrong.

If I delete everything before the first frame with the B marker and delete key,
save that to another MP4 using the MP4v2 Muxer (video & audio copied) and
open it again the time is displayed as "00:00:00.050" where it was
"00:00:00.000" before saving and re-opening.

Avidemux 2.6.21 has the same problem.

Old Avidemux 2.5.6 lets me go back to the first frame and displays that as "P (02)"
whereas ffprobe (or ffplay with "showinfo" filter) say it's an I frame.

Is this already a known bug?
Can that be fixed easily?


C:\Users\Stefan\Desktop>ffprobe -show_frames -select_streams v:0 -i "testvideo.mp4"
ffprobe version 4.1 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181017
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testvideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:01:51.15, start: 0.000000, bitrate: 20760 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 20620 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=1001
pkt_duration_time=0.016683
pkt_pos=48
pkt_size=123486
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=1001
pkt_pts_time=0.016683
pkt_dts=1001
pkt_dts_time=0.016683
best_effort_timestamp=1001
best_effort_timestamp_time=0.016683
pkt_duration=1001
pkt_duration_time=0.016683
pkt_pos=182177
pkt_size=24745
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=B
coded_picture_number=2
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=2002
pkt_pts_time=0.033367
pkt_dts=2002
pkt_dts_time=0.033367
best_effort_timestamp=2002
best_effort_timestamp_time=0.033367
pkt_duration=1001
pkt_duration_time=0.016683
pkt_pos=123534
pkt_size=58643
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=P
coded_picture_number=1
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=3003
pkt_pts_time=0.050050
pkt_dts=3003
pkt_dts_time=0.050050
best_effort_timestamp=3003
best_effort_timestamp_time=0.050050
pkt_duration=1001
pkt_duration_time=0.016683
pkt_pos=285074
pkt_size=24625
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=B
coded_picture_number=4
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=4004
pkt_pts_time=0.066733
pkt_dts=4004
pkt_dts_time=0.066733
best_effort_timestamp=4004
best_effort_timestamp_time=0.066733
pkt_duration=1001
pkt_duration_time=0.016683
pkt_pos=310056
pkt_size=21589
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=B
coded_picture_number=5
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=5005
pkt_pts_time=0.083417
pkt_dts=5005
pkt_dts_time=0.083417
best_effort_timestamp=5005
best_effort_timestamp_time=0.083417
pkt_duration=1001
pkt_duration_time=0.016683
pkt_pos=207335
pkt_size=77344
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=P
coded_picture_number=3
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[/FRAME]

eumagga0x2a

This has been explained numerous times. It is not a bug, it is by design. FFmpeg uses a signed value (int64_t) to store timestamps while Avidemux uses an unsigned value (uint64_t), so that PTS have to be delayed as DTS can't go negative if B-frames are present. If a container specifies that audio playback should be advanced, all video timestamps have to be delayed furthermore to account for that.

Some real bugs regarding calculation of video delay in mp4 and mpegts have been fixed since 2.7.1, you are far better off using the latest nightly.