VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. I am in the habit of converting MKV files to MP4 and, where necessary I add in subtitles. I've been using HandBrake which has, up until now, done a really good job and it's fairly easy to use.
    My problem at the moment is that when I select a file to convert I play it to endure there are subs in place and then perform the conversion. Lately I've had a problem where the subs appeared ok on the computer but didn't show up on the TV. I ran that file through FormatFactory and that fixed the problem.
    What I don't know about format factory is whether a subtitle track (?) on an MKV file is automatically copied to the MP4 file. Also, when adding subs from an external file is there any way to ensure that the displayed subs are in white only, rather than with the blue border?
    TIF
    Simon
    Quote Quote  
  2. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    I can't help with Handbrake or FormatFactory. I don't know what you're getting.
    I don't use either.
    The following batch file expects .srt subtitles.
    If needed, change the extension from .srt in the batch file to suite.
    (.ass or .vtt should work. I haven't tested them.)

    This is what I use, and works for both MKV & MP4 videos in a folder.
    Change the paths to ffmpeg.exe and mkvmerge.exe as required.
    (Or put copies in the folder with the videos and subtitles.)
    Comment out the two lines for the processes you DON'T want.
    If you choose to have burnt in subs then you may wish to change the encoding parameters for libx264.

    Code:
    @echo off
    :: Video tracks and subtitle tracks MUST have matching names (e.g. My Great Video.mkv, My Great Video.srt)
    SETLOCAL
    if not exist New\*.* md New
    
    :: Using mkvmerge.exe - Subtitles-Add-Track-to-MKV
    for %%a in ("*.mp4", "*.mkv") do if exist "%%~na.srt" "mkvmerge.exe" --ui-language en --output "New\%%~na.mkv" --language 0:eng --language 1:eng "%%~na.mp4" --language 0:eng "%%~na.srt" --track-order 0:0,0:1,1:0
    
    :: Using ffmpeg.exe - Subtitles-Add-Track-to-MP4 or MKV
    for %%a in ("*.mp4", "*.mkv") do if exist "%%~na.srt" "ffmpeg.exe" -hide_banner -i "%%a" -sub_charenc ISO-8859-1 -i "%%~na.srt" -map 0:v -map 0:a -map 1 -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng "New\%%a"
    
    :: Using ffmpeg.exe - Subtitles-burn-in-to-MP4 or MKV
    :: To burn in the subs requires a video re-encode.
    :: The audio is copied.
    for %%a in ("*.mp4, "*.mkv") do if exist "%%~na.srt" "ffmpeg.exe" -i "%%a" -vf subtitles="%%~na.srt" -c:v libx264 -preset slow -crf 20 -c:a copy "New\%%a"
    
    pause
    Cheers.
    Quote Quote  
  3. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    To clarify.
    With ffmpeg the output file type is defined by the output file extension. Or the -f parameter (-f MP4)

    With ffmpeg, regardless of the type of file input, MP4 or MKV - if you always want an MP4 output.
    You would change this:
    Code:
    for %%a in ("*.mp4", "*.mkv") do if exist "%%~na.srt" "ffmpeg.exe" -hide_banner -i "%%a" -sub_charenc ISO-8859-1 -i "%%~na.srt" -map 0:v -map 0:a -map 1 -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng "New\%%a"
    To this:
    Code:
    for %%a in ("*.mp4", "*.mkv") do if exist "%%~na.srt" "ffmpeg.exe" -hide_banner -i "%%a" -sub_charenc ISO-8859-1 -i "%%~na.srt" -map 0:v -map 0:a -map 1 -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng "New\%%~na.mp4"
    Cheers
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!