Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
17th February 2019, 15:44 | #1 | Link |
Registered User
Join Date: May 2006
Posts: 3,997
|
VFR to CFR conversion
VEGAS still seems to have issues (creating blended frames or fields) with the handling of (pseudo) VFR files, so I have to convert these VFR files to CFR before importing into VEGAS. I can do this without re-encoding with mkvtoolnix and subsequent remux of the .mkv to a format which Vegas accepts, e.g. m2ts with tsmuxer.
Can the VFR to CFR conversion be done in 1 step with ffmpeg? I tried various options but did not succeed without re-encoding. |
17th February 2019, 15:57 | #3 | Link |
Registered User
Join Date: May 2006
Posts: 3,997
|
"Pseudo" VFR: These are for example .mp4 clips from mobile phones which are slightly off from the standard framerates, for example 30.007 fps or 29.884 fps instead of nominal 29.97 fps. Dumping the time stamps shows that the frames are pretty much CFR with the exception of say the first or last frame(s) which are way out.
I fix these by remuxing the .mp4 to .mkv with mkvtoolnix, selecting the framerate as 30000/1001 and ticking "fix bitstream timing info" in the GUI. Last edited by Sharc; 17th February 2019 at 16:01. |
17th February 2019, 16:48 | #4 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
Try something like:
Code:
ffmpeg -y -i "input.mp4" -c:v copy -an -sn -bsf:v h264_metadata=tick_rate=1001/60000:fixed_frame_rate_flag=1 -f rawvideo - | ffmpeg -y -fflags +genpts -i - -i "input.mp4" -map 0:v -map 1:a -c copy "output.m2ts" |
17th February 2019, 18:33 | #5 | Link |
Registered User
Join Date: May 2006
Posts: 3,997
|
Thanks a lot. Unfortunately no luck, getting the error
Code:
pipe:: Invalid data found when processing input av_interleaved_write_frame(): Broken pipe Error writing trailer of pipe:: Broken pipe frame= 14 fps=0.0 q=-1.0 Lsize= 1037kB time=00:00:00.43 bitrate=19595.8kbits/s speed=3.33x video:1108kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Conversion failed! |
22nd February 2019, 13:34 | #6 | Link | |
Registered User
Join Date: Sep 2005
Location: Moscow, Russia
Posts: 66
|
Quote:
Also you can do this for any particular clip in project bu changing clip's properties. |
|
22nd February 2019, 15:28 | #7 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
For those "pseudo" VFR files, I would use mp4fpsmod . You can batch, and even inplace edit with "-i" (the -i means inplace edit, not "input" like ffmpeg)
eg. Code:
"mp4fpsmod.exe" --fps 0:30000/1001 "input.mp4" -o "output_cfr.mp4" Code:
for %%a in ("*.mp4") do "mp4fpsmod" "%%a" -i --fps 0:30000/1001 pause |
22nd February 2019, 18:10 | #8 | Link | |
Registered User
Join Date: May 2006
Posts: 3,997
|
Quote:
I found that it is also advisable to import the file at project framerate in order to obtain the desired exact output framerate. New to Vegas, still learning. |
|
22nd February 2019, 18:14 | #9 | Link | |
Registered User
Join Date: May 2006
Posts: 3,997
|
Quote:
|
|
4th March 2019, 19:31 | #12 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
If the first frame is way off, then usually other frames are way off. That would not be a "psuedo VFR" file with minor jitter in the timecodes that you could "treat" as CFR . If you look at mediainfo (view=>text) it will usually report a min/max framerate for those types of files and that will only deviate by a tiny fraction.
VFR with large deviations cannot be "fixed" with this method, you would have to convert to CFR by using the conventional re-encoding methods - adding duplicate "placeholder" frames to keep sync |
5th March 2019, 21:04 | #14 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
But the videos that have large deviations usually cannot be treated as CFR with that method. Only the ones that are very slightly off can be 29.979, 30.001 etc.. can usually be treated successfully in sync |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|