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

Merge Fails due to framerate differences in video files #2338

Open
4 tasks done
jagdishadusumalli opened this issue Feb 24, 2025 · 2 comments
Open
4 tasks done

Merge Fails due to framerate differences in video files #2338

jagdishadusumalli opened this issue Feb 24, 2025 · 2 comments

Comments

@jagdishadusumalli
Copy link

jagdishadusumalli commented Feb 24, 2025

The fewer issues I have to read, the more new features I will have time to implement, so I ask that you please try these things first

Operating System

MacOS 15

Steps to reproduce

Hi,
I records kids football videos on Honor 200 Pro Android Smartphone.
There are generally 2-6 videos with different durations as shown in example below
All videos were shot on 4k@60 fps but as all mobile phones do optimization for framerate
they reduce the frames according to lighting and various other conditions (phone temperature).
(Only some phones have the feature to disable Automatic Frame rate feature (for e.g Xiaomi 14))

VID_20250223_111409 | Size: 232 MiB | Duration: 00:00:48.077 | Frame Rate: 60.000 fps | Format: MPEG-4 | Codec ID: mp42
VID_20250223_113523 | Size: 5.57 GiB | Duration: 00:19:50.213 | Frame Rate: 50.166 fps | Format: MPEG-4 | Codec ID: mp42
VID_20250223_120234 | Size: 5.82 GiB | Duration: 00:20:38.187 | Frame Rate: 38.083 fps | Format: MPEG-4 | Codec ID: mp42
VID_20250223_120409 | Size: 391 MiB | Duration: 00:01:21.479 | Frame Rate: 32.574 fps | Format: MPEG-4 | Codec ID: mp42
VID_20250223_122909 | Size: 900 MiB | Duration: 00:03:07.552 | Frame Rate: 44.198 fps | Format: MPEG-4 | Codec ID: mp42

I simply merge all the videos and upload to youtube and dont do any processing
The issue is most times (75%) the merged file works even if the framerates are different
but sometime the merged file plays upto the some part and then it gets stuck.

I noticed when it works the final merged file has framerate as 30fps or the lowest framerate from the files given files.

Is it possible to specify an option to take the lowest available framerate from the files and do the merging so that it always works?

It will be great enhancement on top of what this great tool does so nicely saving hunderds or rendering times of CPU's and GPU's.

Expected behavior

The multi video files output merged file should play properly all through out

Actual behavior

The multi video files output merged file plays up to some length and its stuck due to mismatch in framrate.
But many times the merged file works and it shows the framerate as 30fps or the lowest from the files being merged

Share log from developer tools

No response

@mifi
Copy link
Owner

mifi commented Feb 25, 2025

If we were to specify a fixed framerate for the whole merged video, wouldn’t that mean that each clip would play back at different speeds because the actual number of frames per second is different? Is that desireable?

@jagdishadusumalli
Copy link
Author

If we were to specify a fixed framerate for the whole merged video, wouldn’t that mean that each clip would play back at different speeds because the actual number of frames per second is different? Is that desireable?

Hi @mifi Thanks for replying and this wonderful software you wrote.
i did not fully understand the playback point you mentioned.
On Xiaomi 14 Phone I shoot 4k@30fps and sometimes 4k@60fps both videos playback at same speed i.e 1x (normal).

I also further did some more testing and have use cases.

  1. I recorded a 10 minute footage with 4k@30 fps and
  2. another 10 minute footage by changing the framerate to 4k@60fps ()

Just 2 clips and i merged them both.
The resultant merged video played perfectly and its framerate was shown as 30fps in the mediainfo cli tool with 4k resolution.

The issue with the new flagship smartphones is to optimize on storage space they sometime switch to VFR (Variable Frame rate) from CFR (Constant Frame Rate) automatically... we have no control on it.

Below is a batch of files which fails (merge file stops playing after 1st clip plays).
Here the phone was set to 4k@60fps for all videos but the phone recorded at various framerates.
i also added the Frame Rate mode column now.

FN: VID_20250223_111409 | D: 00:00:48.077 | FS: 232 MiB | FR: 60.000 fps | FMR: CFR | W: 3840 | H: 2160 | F: AVC | C: avc1
FN: VID_20250223_113523 | D: 00:19:50.213 | FS: 5.57 GiB | FR: 50.166 fps | FMR: VFR | W: 3840 | H: 2160 | F: AVC | C: avc1
FN: VID_20250223_120234 | D: 00:20:38.187 | FS: 5.82 GiB | FR: 38.083 fps | FMR: VFR | W: 3840 | H: 2160 | F: AVC | C: avc1
FN: VID_20250223_120409 | D: 00:01:21.479 | FS: 391 MiB | FR: 32.574 fps | FMR: VFR | W: 3840 | H: 2160 | F: AVC | C: avc1
FN: VID_20250223_122909 | D: 00:03:07.552 | FS: 900 MiB | FR: 44.198 fps | FMR: VFR | W: 3840 | H: 2160 | F: AVC | C: avc1

below is the command i used for getting the info above on the video files
$ brew install mediainfo
$ ls . | while read file; do
printf "%s | " "$(mediainfo --Output="General;FN: %FileName% | D: %Duration/String3% | FS: %FileSize/String%" "$file")"
printf "%s\n" "$(mediainfo --Output="Video; FR: %FrameRate% fps | FMR: %FrameRate_Mode% | W: %Width% | H: %Height% | F: %Format% | C: %CodecID%" "$file")"
done

I think this is a very common use case where people record multiple video clips through the day/ tour and just want to merge it all into one file so that they can upload it to youtube (no processing).
I believe there has to be a way/ trick to merge all these files with some framerate overriding magic
and save unnecessary rendering on FCP.

More than happy to test this issue for you or provide the test files of working batch of files and non working batch.

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

2 participants