I typically use both ffprobe and mediainfo to get video info on a bunch of my files. I noticed that on a few videos in particular, they'll give me different results. Here's just 1 of those files:
ffprobe (json):
mediainfo:Code:"r_frame_rate": "30/1", "avg_frame_rate": "30/1",
I suspect it has something to do with file using variable framerate but still...Code:Frame rate : 24.000 FPS
Here's a link to a short 10 second mkv to see for youself: https://www82.zippyshare.com/v/JOJm40KZ/file.html
The problem is I need to re-encode the video and don't know if I should encode it to 30 fps or 24 fps. Any ideas or suggestions?
+ Reply to Thread
Results 1 to 11 of 11
-
Last edited by syrist; 20th May 2020 at 07:16.
-
The same thing is happening on other animated shows released by ALiGN. I use ffms2 all the time but I provide it proper fpsnum and fpsden values so my encodes are fine. You think maybe the group didn't use ffms2 properly?
Last edited by syrist; 19th May 2020 at 18:56.
-
Never dealing with vfr, never had to, but I am curious about it regarding how source plugins handle this vs. timecodes.
clip = core.ffms2.Source(source_path, cachefile=ffindex_file, timecodes=r'test.mkv.txt')
If I print timecodes, it alternates frame lenght 0.033 , 0.05, 0.033, 0.05 so about 24x to 1 second:
Code:# timecode format v2 0.00 33.00 83.00 117.00 167.00 200.00 250.00 284.00 334.00 367.00 417.00 450.00 501.00 534.00 584.00 617.00 667.00 701.00 751.00 784.00 834.00 868.00 918.00 951.00 1001.00 . . . 12137.00 12170.00 12221.00 12254.00
Last edited by _Al_; 19th May 2020 at 18:42.
-
This is my command to generate the json data:
Code:ffprobe test.mkv -v error -show_format -show_streams -print_format json > test.json
Code:{ "streams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "profile": "High", "codec_type": "video", "codec_time_base": "1/60", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 1280, "height": 720, "coded_width": 1280, "coded_height": 720, "has_b_frames": 0, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "16:9", "pix_fmt": "yuv420p", "level": 31, "color_range": "tv", "color_space": "bt709", "color_transfer": "bt709", "color_primaries": "bt709", "chroma_location": "topleft", "field_order": "progressive", "refs": 1, "is_avc": "true", "nal_length_size": "4", "r_frame_rate": "30/1", "avg_frame_rate": "30/1", "time_base": "1/1000", "start_pts": 0, "start_time": "0.000000", "bits_per_raw_sample": "8", "disposition": { "default": 1, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 }, "tags": { "BPS-eng": "2586112", "DURATION-eng": "00:00:12.287000000", "NUMBER_OF_FRAMES-eng": "295", "NUMBER_OF_BYTES-eng": "3971945", "_STATISTICS_WRITING_APP-eng": "mkvmerge v46.0.0 ('No Deeper Escape') 64-bit", "_STATISTICS_WRITING_DATE_UTC-eng": "2020-05-19 20:17:24", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES" } }, { "index": 1, "codec_name": "aac", "codec_long_name": "AAC (Advanced Audio Coding)", "profile": "HE-AAC", "codec_type": "audio", "codec_time_base": "1/48000", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "sample_fmt": "fltp", "sample_rate": "48000", "channels": 2, "channel_layout": "stereo", "bits_per_sample": 0, "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/1000", "start_pts": 0, "start_time": "0.000000", "disposition": { "default": 1, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 }, "tags": { "BPS-eng": "126795", "DURATION-eng": "00:00:12.331000000", "NUMBER_OF_FRAMES-eng": "289", "NUMBER_OF_BYTES-eng": "195440", "_STATISTICS_WRITING_APP-eng": "mkvmerge v46.0.0 ('No Deeper Escape') 64-bit", "_STATISTICS_WRITING_DATE_UTC-eng": "2020-05-19 20:17:24", "_STATISTICS_TAGS-eng": "BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES" } } ], "format": { "filename": "D:\\VID\\test.mkv", "nb_streams": 2, "nb_programs": 0, "format_name": "matroska,webm", "format_long_name": "Matroska / WebM", "start_time": "0.000000", "duration": "12.331000", "size": "4178054", "bit_rate": "2710601", "probe_score": 100, "tags": { "encoder": "libebml v1.3.10 + libmatroska v1.5.2", "creation_time": "2020-05-19T20:17:24.000000Z" } } }
Last edited by syrist; 19th May 2020 at 19:16.
-
The file is exactly what I said: VFR that alternates between 1/30 and 1/20 second per frame. I believe this is because it was made from a source with 3:2 pulldown (30i) or 3:2 duplicates (60p) and the duplicate fields/frames were removed. Of course, the original production was constant 24 fps, like virtually all film sources. So you should treat it as constant 24p.
Here's the ffprobe command I used to generate stats for each frame:
Code:ffprobe.exe -v 32 -stats -y -hide_banner -i input.mkv -select_streams v -print_format csv -of csv -show_entries frame >> "output.csv"
-
Code: .......
ffprobe.exe -v 32 -stats -y -hide_banner -i input.mkv -select_streams v -print_format csv -of csv -show_entries frame
that pattern 0,33,50,33,50 ... is just mkvmerge algorithm solution to come up with 24 frames in 1 second? Could it be some other appropriate sequence that fits into that one second?
Code:frame,video,0,1,0,0.000000,0,0.000000,0,0.000000,33,0.033000,11017,1001,1280,720,yuv420p,1:1,I,0,0,0,0,0,tv,bt709,bt709,bt709,topleft frame,video,0,0,33,0.033000,33,0.033000,33,0.033000,50,0.050000,12026,40,1280,720,yuv420p,1:1,P,1,0,0,0,0,tv,bt709,bt709,bt709,topleft frame,video,0,0,83,0.083000,83,0.083000,83,0.083000,33,0.033000,12078,40,1280,720,yuv420p,1:1,P,2,0,0,0,0,tv,bt709,bt709,bt709,topleft frame,video,0,0,117,0.117000,117,0.117000,117,0.117000,50,0.050000,12126,40,1280,720,yuv420p,1:1,P,3,0,0,0,0,tv,bt709,bt709,bt709,topleft frame,video,0,0,167,0.167000,167,0.167000,167,0.167000,33,0.033000,12178,40,1280,720,yuv420p,1:1,P,4,0,0,0,0,tv,bt709,bt709,bt709,topleft . .
-
When a 24p source is broadcast as 720p60 video 24 film frames has to somehow become 60 video frames. This is usually accomplished by duplicating film frames in a 2:3 pattern. One film frame is displayed for the duration of 2 video frames, the next is displayed for the duration of 3 video frames, alternating between the two. So the film frames are displayed for 1/30 (2/60) second and 1/20 (3/60) second. After one second 24 film frames have become 60 video frames. Someone started with such a 720p60 video and encoded it as variable frame rate. The encoder saw that two frames were identical and encoded them as one frame with a duration of 1/30 second, then three identical frames were encoded as one frame with a duration of 1/20 second, etc.
-
Thanks for all the info. I guess the bottom line is I need a way to accurately report the average framerate of a source video so I can pass that info on the encoder. From what I learned in this thread, ffprobe probably only looks at the first frame and thus gives an incorrect representation of the overall framerate on certain variable framerate videos (like the sample I attached).
So I'll just use mediainfo to create my json going forwards. -
Though it works better in this case, I don't know if MediaInfo is any more reliable than ffprobe in general. I believe MediaInfo only reports the frame rate in the header. That may not always be accurate either. Some programs indicate the max frame rate in the header when encoding VFR. And even the average frame rate doesn't mean you can encode an entire video at that frame rate without conversion. For example, someone may have joined a 24p video and a 30p video into a single VFR video. The average might be 27p but if you encode 27p CFR the first part of the video will play too fast, the second part too slow. The audio will be in sync at the very start and the very end, but will be out of sync throughout the rest of the video.
Similar Threads
-
MediaInfo reporting incorrect file length
By ZetaStax in forum Newbie / General discussionsReplies: 6Last Post: 4th Sep 2019, 15:47 -
How to get the number of frames of a video file with ffprobe?
By marcorocchini in forum Newbie / General discussionsReplies: 36Last Post: 12th May 2019, 05:06 -
ffprobe: ho to the UmID from a video file?
By marcorocchini in forum Newbie / General discussionsReplies: 8Last Post: 24th May 2018, 06:21 -
QUERY: MKV and TS versions of same file reporting different sizes in Toast?
By amckinney in forum MacReplies: 2Last Post: 28th May 2017, 14:56 -
MP4 File - MediaInfo only shows file size. Encrypted maybe?
By bbabraham in forum Software PlayingReplies: 8Last Post: 18th Sep 2015, 16:59