VideoHelp Forum




+ Reply to Thread
Results 1 to 5 of 5
  1. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    Been using ffmpeg and a bat file I came across to convert DTS to AAC audio - which works.
    Now I want to merge the subs from the source into the new file without encoding and I can't quite figure how to modify the bat.

    Here's the ffprobe data (edited) .



    Input #0, matroska,webm, from 'who.mkv':

    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 50 t
    bc (default)

    Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)

    Stream #0:2(eng): Subtitle: dvd_subtitle, 1280x720 (default)
    -and the bat file.

    Code:
    REM convert DTS audio to aac
    @echo off
    
    for %%F IN (*.mkv) do (
    echo * %%~nF.mkv
    echo.
           ffmpeg -i %%~nF.mkv -c:a pcm_s16le -f wav - | neroAacEnc -if - -ignorelength -of %%~nF.aac
    echo.
    echo * Merging new AAC audio into MKV
           ffmpeg -i %%~nF.mkv -i %%~nF.aac -c:v copy -c:a copy -map 0:v:0 -map 1:a:0 %%~nF.AAC.mkv
    echo.
    rem pause
    echo * Removing temporary file
           del %%~nF.aac					
                                )
    echo.
    echo * All Finished
    :exit
    pause
    Quote Quote  
  2. Code:
    -c:v copy -c:a copy
    copies all video (:v) and audio (:a) streams, adding:
    Code:
    -c:s copy
    will tell ffmpeg to also copy the subittle (:s) streams
    https://www.ffmpeg.org/ffmpeg-all.html

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  3. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    Thank you for the suggestions.
    If I used the 'copy' commands without 'map', the new audio wasn't muxed into the output.
    After stumbling around I changed the command thus:

    Code:
     ffmpeg -i %%~nF.mkv -i %%~nF.aac -c:v copy -c:s copy -c:a copy  -map 0:v:0  -map 0:s:0 -map 1:a:0  %%~nF.AAC.mkv
    This gave me the new audio and the subs.

    ffmpeg listed the following after muxing - which has me baffled:

    Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Stream #0:2 -> #0:1 (copy)
    Stream #1:0 -> #0:2 (copy)
    I don't know how the Probe data matches up with the output data - any ideas??
    Input #0, matroska,webm, from 'who.mkv':

    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 50 t
    bc (default)

    Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)

    Stream #0:2(eng): Subtitle: dvd_subtitle, 1280x720 (default)
    Quote Quote  
  4. try:
    Code:
    ffmpeg -i %%~nF.mkv -i %%~nF.aac -c:v copy -c:s copy -c:a copy  -map 0:v  -map 1:a -map 0:s %%~nF.AAC.mkv
    you can also try:
    Code:
    ffmpeg -i %%~nF.mkv -i %%~nF.aac -c:v copy -c:s copy -c:a copy  -map 0 -map -0:a -map 1:a %%~nF.AAC.mkv
    both should work iirc.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  5. Member
    Join Date
    Dec 2005
    Location
    Canada
    Search Comp PM
    Thank you Selur, both codes worked without problems.
    Quote Quote  



Similar Threads

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