Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong duration of AVC elementary stream after recent changes #2040

Open
MichalFiglarowicz opened this issue May 10, 2024 · 4 comments
Open

Comments

@MichalFiglarowicz
Copy link

MediaInfo v24.01 reports different Duration and Frame Rate of the AVC (H.264) elementary stream then v22.09. I only noticed it when I use the source which was sliced from the origin video (but not sure if it needed). Here is how I prepared the source:
ffmpeg -y -ss 00:00:05.0 -i big_buck_bunny.mov -t 00:00:10.0 -c:v libx264 -an -vf "fps=30,scale=640:480" -f h264 bunny.h264
So it cut from 5 second to 15 second of source, changes fps to 30 + downsizes image (just for reducing size of the file) and outputs as H.264 elementary stream.
I would expect the duration of such stream to be close to 10 seconds + fps reported as 30.

I noticed different behaviour of MediaInfoLib after commit 5271548

Before that commit I got Duration 10 s 0 ms and FPS 30.000 FPS

General
Complete name                            : bunny.h264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 1.16 MiB
Duration                                 : 10 s 0 ms
Overall bit rate                         : 970 kb/s
Writing library                          : x264 core 164 r3108 31e19f9
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=15 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Duration                                 : 10 s 0 ms
Bit rate                                 : 970 kb/s
Width                                    : 640 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Variable
Frame rate                               : 30.000 FPS

But after this commit I get Duration 6 s 933 ms and FPS 43.271 FPS

General
Complete name                            : bunny.h264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 1.16 MiB
Duration                                 : 6 s 933 ms
Overall bit rate                         : 1 399 kb/s
Frame rate                               : 43.271 FPS
Writing library                          : x264 core 164 r3108 31e19f9
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=15 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Duration                                 : 6 s 933 ms
Bit rate                                 : 1 399 kb/s
Width                                    : 640 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Variable
Frame rate                               : 43.271 FPS

I also noticed that the difference in Duration is highly related with the fps which I use to encode the stream.

@MichalFiglarowicz
Copy link
Author

MichalFiglarowicz commented May 15, 2024

Here is an example file - named .mp4 to be able to attach to issue ;-)

bunny_30fps.h264.mp4

generated with

ffmpeg -y -ss 00:00:05.0 -i big_buck_bunny.mov -t 00:00:10.0  -c:v libx264 -an -vf "fps=30,scale=640:480" -f h264  bunny.h264

Not sure if the file can be downloaded. If not please give me a hint how to send the sources in proper way.

@ValeZAA
Copy link

ValeZAA commented May 21, 2024

It can be downloaded, right click, save video.

Before that commit I got Duration 10 s 0 ms and FPS 30.000 FPS

Well, ffplay cannot recognise any fps in this video and just says 25 fps. Now, this is a mistake, as it appears it has 60 fps data.

[trace_headers @ 000002185997d200] 70 vui_parameters_present_flag 1 = 1
[trace_headers @ 000002185997d200] 71 aspect_ratio_info_present_flag 0 = 0
[trace_headers @ 000002185997d200] 72 overscan_info_present_flag 0 = 0
[trace_headers @ 000002185997d200] 73 video_signal_type_present_flag 0 = 0
[trace_headers @ 000002185997d200] 74 chroma_loc_info_present_flag 0 = 0
[trace_headers @ 000002185997d200] 75 timing_info_present_flag 1 = 1
[trace_headers @ 000002185997d200] 76 num_units_in_tick 00000000000000000000000000000001 = 1
[trace_headers @ 000002185997d200] 108 time_scale 00000000000000000000000000111100 = 60
[trace_headers @ 000002185997d200] 140 fixed_frame_rate_flag 0 = 0

@JeromeMartinez
Copy link
Member

Well, ffplay cannot recognise any fps in this video and just says 25 fps.

Quick test with FFmpeg 4.4.2 and 30 fps are detected:
Stream #0:0: Video: h264 (High), yuv420p(progressive), 320x240, 30 fps, 30 tbr, 1200k tbn, 60 tbc

Issue is in MI, no discussion about that.

@ValeZAA
Copy link

ValeZAA commented May 21, 2024

Update ffmpeg?

IMG_20240521_144825_267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants