Taking a 5.1 surround .mkv file and converting it to stereo mp4 using ffmpeg. My code looks like this
Even though input.mkv is a constant frame rate 23.98p file, what I’m getting is a variable frame rate 23.98 output file. Why is this? Thanks.ffmpeg -i input.mkv -vcodec copy -acodec libmp3lame output.mp4
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 18 of 18
Thread
-
-
Recommend you create a new ticket over at https://trac.ffmpeg.org/
You'll need to post the complete un-cut log output of the ffmpeg run, and post a link to the sample input file used.
Cheers. -
Actually, no.
MediaInfo may report this resulting MP4 container as VFR because the generated flavour of MP4 container is able to support VFR; that doesn't certainly mean the frame actually varies, because MediaInfo did not analyse a statistic over the whole play time. And even if, the variance is probably only in very few milliseconds, you won't notice. -
Interesting. I was using MediaInfo, and I also checked via VirtualDub and Adobe Premiere Pro. All three reported it as VFR...but you're right, it may not actually be.
the generated flavour of MP4 container is able to support VFR -
And even if, the variance is probably only in very few milliseconds, you won't notice.
-
According to the docs it should be creating a CFR file. Try using ffprobe -show_streams to see what it says.
Also you could try the first method here: https://trac.ffmpeg.org/wiki/How to speed up / slow down a video to recreate the the timestamps. -
This is a feature, not a bug. ffmpeg uses a time base of 1/90000 for MP4 files. 24000/1001 cannot be represented exactly as N/90000 where N is an integer. It works out to 7353.75/90000. Using either 7353/90000 or 7354/90000 would result in a slow drift from the true frame rate. So ffmpeg uses a variable frame rate alternating between 3753/90000 for 1 frame and 3754/90000 for 3 frames. So technically it's variable frame rate. But it's effectively a constant frame rate.
Last edited by jagabo; 16th Sep 2021 at 20:44.
-
-
This sounds right but...frankly, this explanation is a bit over my head.
This Variable Frame Rate thing seems to be an issue for me once again. When I export an MP4 from Adobe Premiere Pro, it's a CFR file. If I do anything to it with FFMpeg, it becomes VFR. This causes issues in AVStoDVD. Is there any way for me to force FFMpeg to create a CFR file? -
Unfortunately it seems to go both ways. Right now my use case is taking an MP4, converting to MKV and adding subtitles, then burning with AVStoDVD. The output file is always VFR (regardless of whether I add subtitles), even though the original MP4 is CFR. AVStoDVD doesn't like that, the video winds up very choppy during playback.
-
CFR MP4 to MKV can often lead to VFR because of the container timebase differences.
what do you mean "adding subtitles" ? did you mean muxing in soft subs ? If so, try mkvmerge (mkvtoolnix) if they are a format not supported by mp4 . Or are you hardcoding them with ffmpeg ? If so, export MP4 . What else are you doing in ffmpeg?
Adobe MP4 to ffmpeg MP4 should be CFR because the timebase is 1/24000 for a 23.976 file (24000/1001) exported from Adobe . The timestamps are retained -
-
@seanmcnally
mp4fpsmod.exe converts the VFR to CFR
https://github.com/nu774/mp4fpsmod
(You may have to google for the executable)
Or try by adding in your ffmpeg commandline:
-video_track_timescale 60
(you may have to change the number, see the docs)
Edit1: Here an executable of mp4fpsmod:
http://www.mediafire.com/file/qyrj0d84gfauvdm/mp4fpsmod-0.26-Win64.7z/file
Edit2:
Or you could remux your VFR mp4 to an intermediate file (container) which does not support VFR (e.g. *.avi or *.ts), and then remux back to mp4. Something like:
Code:ffmpeg -r 24000.0/1001.0 -i "yourVFR.mp4" -c:v copy -c:a copy "yourCFR.avi" ffmpeg -fflags +genpts -i "yourCFR.avi" -c:v copy -c:a copy "yourCFR.mp4" del yourCFR.avi
Last edited by Sharc; 8th Jan 2022 at 04:38.
-
You probably should upload a small sample of a "VFR" source, the encoded version after AVStoDVD has had at it, and also the AVStoDVD log file. I'll confess the way AVStoDVD converts truly VFR video to CFR makes no sense to me, but it'd be better to play with some samples rather than guess.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
Found the answer, thanks to poisondeathray, as well as some other users on the site. The answer is basically to just not use FFMpeg, but if you must, the process for fixing this is different depending on what kind of file you are working with
For MP4 files, use MP4FPSMod. It's not easy to find a link to the Windows version, but here's the one I used.
Run this from the command line:
Code:"mp4fpsmod.exe" --fps 0:24000/1001 "file.mp4" -o "file_fixed.mp4"
For 23.976fps, use 24000/1001.
For 29.97fps, use 30000/1001.
For 59.94fps, use 60000/1001.
For 24fps, use 24000/1000
For 30fps, use 30000/1000
For 60fps, use 60000/1000.
For MKV files, you need MKVToolNix. There are two ways of doing this - to do it from the GUI, you need to create a text file with this inside it
Code:# timestamp format v1 assume 23.976
Alternatively, you can do this from the command line without needing to create a text file, using this code:
Code:"C:\Program Files\MKVToolNix\mkvmerge.exe" --output "C:\file_fixed.mkv" --language 0:eng --default-track 0:yes --display-dimensions 0:1920x1080 --default-duration 0:24000/1001p --language 1:eng --default-track 1:yes (C:\original_file.mkv) --track-order 0:0,0:1
Similar Threads
-
Convert VFR to Image Sequence (Keeping VFR)
By Vaengence in forum EditingReplies: 11Last Post: 29th Dec 2020, 16:02 -
Converting Avi to Mpg using ffmpeg
By sumit_pankaj in forum Video ConversionReplies: 5Last Post: 31st May 2020, 20:42 -
Help with converting to AVI file using FFMpeg
By maxvkwong in forum Video ConversionReplies: 0Last Post: 22nd May 2019, 07:40 -
Converting VFR clips for Vegas editing
By obsidiana in forum EditingReplies: 2Last Post: 3rd Sep 2018, 21:24 -
Converting vfr clips to VfW AVI-containered cfr lips
By turk690 in forum Video ConversionReplies: 1Last Post: 5th Feb 2017, 07:35