VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 23 of 23
Thread
  1. 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:

    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"
    Thank you.
    Quote Quote  
  2. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    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
    Quote Quote  
  3. 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.
    Quote Quote  
  4. Originally Posted by Nico Darko View Post
    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_005fmetadata
    Last edited by jagabo; 12th Oct 2020 at 18:30.
    Quote Quote  
  5. 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
    Quote Quote  
  6. 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 )
    The new files are created in a folder called New, within the folder with the batch and source files.
    Quote Quote  
  7. Originally Posted by jagabo View Post
    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 )
    The new files are created in a folder called New, within the folder with the batch and source files.
    I created a bat file like I always do with ffmpeg, but it doesn't work, the "New" folder was created but that's all.
    Quote Quote  
  8. 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.
    Quote Quote  
  9. It says "%%F was unexpected".
    Quote Quote  
  10. 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.
    Quote Quote  
  11. 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".
    Quote Quote  
  12. 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 %.
    Quote Quote  
  13. Ok, I copied/pasted the command line again and it worked!! I must have missed something before.

    Thank you!!
    Quote Quote  
  14. You're welcome.
    Quote Quote  
  15. 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
    What do you think?
    Quote Quote  
  16. 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.
    Quote Quote  
  17. 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?
    Quote Quote  
  18. Originally Posted by Nico Darko View Post
    I guess one difference is that here the format is MPEG Video instead of AVC, and interlaced instead of progressive. Could that be it?
    Yes. MPEG2 is much more restrictive than AVC.

    Originally Posted by Nico Darko View Post
    And if so, the only other way to do frame conversion is to reencode the video?
    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.

    Originally Posted by Nico Darko View Post
    Nothing I could do differently with MKVToolNix or another program?
    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?
    Quote Quote  
  19. Originally Posted by jagabo View Post
    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?
    Yeah, it plays fine on my computer. I can try modifying the bitstream flags, if that's the only option. How can I do that?
    Quote Quote  
  20. Originally Posted by Nico Darko View Post
    I can try modifying the bitstream flags, if that's the only option. How can I do that?
    I don't know.
    Quote Quote  

  21. Thanks anyway. If someone has an idea...
    Quote Quote  
  22. I'll just start a new topic about changing the frame rate of MPEG2 videos, maybe someone will know something.
    Quote Quote  



Similar Threads