Hi.
I have a bunch of mkv files that I need to convert from 25fps to 23.976 fps. I've already converted the audio to the correct frame rate, the new audio files are all ac3 and have the same name as the mkv files.
So what would be the command line to merge the ac3 files with the mkv ones? while converting the video to 23.976 fps at the same time?
I already have this one that I know works to merge mkv and ac3 and replacing the original audio, I just need to add something to convert the frame rate:
Thank you.Code:for %%F in (*.mkv) do ffmpeg -y -i "%%~nxF" -i "%%~nF.ac3" -c copy -map 0:v -map 1:a -disposition:a:0 default -disposition:a:1 none "/_%%~nxF"
+ Reply to Thread
Results 1 to 23 of 23
-
-
Depends on what you really did with the audio.
You say you "converted the audio framerate", but audio does not have a framerate. It has a samplerate, and a bitrate. Did you change the duration?
If no duration was changed, then how do you expect to change the framerate of the video (yes, video DOES have a framerate)? 25->23.976 could be slowed down (keeping all frames but changing duration), or could be framedropped (losing frames but keeping duration).
If neither had duration change, then it should be a matter of just re-muxing.
If either or both stream durations changed, you will have to first match durations & ensure they have proper sync between each other.
Scott -
Yeah sorry I wasn't very clear, I've slowed-down the original audio so it would match with the video converted from 25 to 23.976 fps. So all I need now is to convert the video to 23.976 fps (changing the duration) and include the new audio with one command line.
I usually do it using MKVToolNix GUI. I just want to use a command line this time so I can batch convert several files. -
MKVToolNix GUI can show you the command equivalent. You could easily modify that for batch processing.
With ffmpeg I think you need to set the tick_rate parameter in the h.264 bitstream metadata.
https://ffmpeg.org/ffmpeg-bitstream-filters.html#h264_005fmetadataLast edited by jagabo; 12th Oct 2020 at 17:30.
-
Ok, well this is the command line that MKVToolNix gives me, but I'm not sure how to turn it into batch mode for ffmpeg.
"C:/Program Files/MKVToolNix\mkvmerge.exe" --ui-language fr --output ^"E:\301 ^(4^).mkv^" --no-audio --language 0:eng --default-duration 0:24000/1001p --fix-bitstream-timing-information 0:1 ^"^(^" ^"E:\Download\301.mkv^" ^"^)^" --language 0:eng ^"^(^" ^"E:\Download\301.ac3^" ^"^)^" --track-order 0:0,1:0 -
I think this will work:
Code:md New for %%F in (*.mkv) do ( "C:\Program Files\MKVToolNix\mkvmerge.exe" --ui-language fr --output "New\%%~nF.mkv" --no-audio --language 0:eng --default-duration 0:24000/1001p --fix-bitstream-timing-information 0:1 --language 0:eng "%%~nxF" "%%~nF.ac3" --track-order 0:0,1:0 )
-
Error messages? Try adding PAUSE after the last line -- that will leave the window open until you press a key. If the window still closes before you can see the error message (some errors cause the entire process to exit, so the PAUSE won't be executed) try running the batch file from a command line window.
-
Are you running the command from a batch file or are you typing them in a CLI window? The commands I gave are for a batch file. The syntax is a little different if you are typing them directly.
-
I'm running it from a batch file, just like I do using this one (which works fine):
for %%F in (*.mkv) do ffmpeg -y -i "%%~nxF" -i "%%~nF.ac3" -c copy -map 0:v -map 1:a -disposition:a:0 default -disposition:a:1 none "/_%%~nxF"
But nothing happens with the one you gave me, even if I add pause. And when I copy/paste it in a command line window, it says "%%F was unexpected". -
The batch file worked perfectly for me. The batch file needs to be in the same folder as all the MKV/AC3 files. Make sure the path is correct for MKVMerge.exe.
At the command line all the %% need to be just one %. -
Ok, I copied/pasted the command line again and it worked!! I must have missed something before.
Thank you!! -
Hi again.
So I've converted all my files to 23.976fps but reading them now on my blu-ray player, the playback is a lot more jerky than it should (I tried another player, as well as my TV and it's the same).
I've converted PAL files to NTSC frame rate before and I haven't had that issue. I tried converting one file again with MKVToolNix, ticking "Fix bitstream timing info" again, but same result.
So I'm thinking it's coming from the files themselves, they might be harder to convert than previous ones I had? They are different in the sense that they come from my PAL dvds that I've remuxed using MakeMKV, so they're just like on dvd, no re-encoding.
Here's the mediainfo for one file (after conversion to 23.976fps):
General
Unique ID : 4641677125443864067923835415291516482 (0x37DF459E71A083B9B8445F6AD8C5642)
Complete name : E:\Download\\New\S03E03 - The Bus Stops Here (1).mkv
Format : Matroska
Format version : Version 4
File size : 1.91 GiB
Duration : 46 min 26 s
Overall bit rate mode : Variable
Overall bit rate : 5 886 kb/s
Encoded date : UTC 2020-10-13 22:44:49
Writing application : mkvmerge v37.0.0 ('Leave It') 64-bit
Writing library : libebml v1.3.9 + libmatroska v1.5.2
Video
ID : 1
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings : BVOP
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format settings, GOP : M=3, N=12
Format settings, picture struc : Frame
Codec ID : V_MPEG2
Codec ID/Info : MPEG 1 or 2 Video
Duration : 46 min 26 s
Bit rate mode : Variable
Bit rate : 5 692 kb/s
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Original frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.572
Time code of first frame : 01:00:00:00
Time code source : Group of pictures header
GOP, Open/Closed : Open
GOP, Open/Closed of first fram : Closed
Stream size : 1.85 GiB (97%)
Language : English
Default : No
Forced : No
Audio
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Commercial name : Dolby Digital
Codec ID : A_AC3
Duration : 46 min 24 s
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Compression mode : Lossy
Stream size : 63.7 MiB (3%)
Service kind : Complete Main
Default : Yes
Forced : No
Menu
00:00:00.000 : en:Chapitre 01
00:02:09.120 : en:Chapitre 02
00:08:44.640 : en:Chapitre 03
00:18:44.640 : en:Chapitre 04
00:28:44.640 : en:Chapitre 05
00:38:44.640 : en:Chapitre 06
00:44:00.960 : en:Chapitre 07
00:44:30.800 : en:Chapitre 08
-
I don't know exactly what's going wrong but relying on the player to change the playback speed is fraught with problems. Does the original 25 fps file play smoothly? There are many ways to do frame rate conversions are performed. Not all of them give smooth results. You may have to reencode the audio and/or video with a proper frame rate conversion.
-
Yeah the original 25 fps file plays smoothly.
I didn't think I was relying on the player to change the speed. Do you mean that by not re-encoding but simply remuxing (by changing the frame rate), it doesn't work for every type of file? But why was I able to convert other mkv files without jerky playback before? I guess one difference is that here the format is MPEG Video instead of AVC, and interlaced instead of progressive. Could that be it? And if so, the only other way to do frame conversion is to reencode the video? (the audio was reencoded with ffmpeg already). Nothing I could do differently with MKVToolNix or another program? -
Yes. MPEG2 is much more restrictive than AVC.
Probably. There's no such thing as 23.976 fps interlaced MPEG2 in commercial video. I'm not sure the MPEG2 spec even supports it. It's not surprising some players have problems with it.
PAL video is often encoded interlaced even though the frames are progressive. If that's the case here it might be possible to convince the player that the video is progressive. You would somehow have to modify the MPEG 2 bitstream flags.
Does the file play smoothly on your computer? -
-
I'll just start a new topic about changing the frame rate of MPEG2 videos, maybe someone will know something.
Similar Threads
-
Variabel frame rate / constant frame rate problem with free version of VSDC
By danielschut in forum Newbie / General discussionsReplies: 6Last Post: 11th Jun 2020, 02:50 -
Converting .TS with variable frame rate to .MKV
By MeltdownSpectre in forum Video ConversionReplies: 3Last Post: 4th Jun 2020, 02:11 -
Convert Frame Rate Across Multiple SRT files
By twathle in forum SubtitleReplies: 0Last Post: 5th Jul 2018, 02:50 -
transcode Variable Frame Rate (VFR) AVC video to Constant Frame rate (CFR)
By hydra3333 in forum Video ConversionReplies: 2Last Post: 4th Mar 2018, 05:01 -
Need help with ffmpeg script to batch convert audio in MKV files
By mikeveli20 in forum AudioReplies: 5Last Post: 18th Nov 2016, 13:21