VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Ret. Hippie Guitar Player Axel Slingerland's Avatar
    Join Date
    Jul 2020
    Location
    The Lost Coast
    Search Comp PM
    Greetings from the Lost Coast of Northern California,

    I have a number of videos I recorded while on vacation, and a lot of old recordings I think would make perfect soundtracks for them.

    Can someone tell me how to write a simple batch file for this?

    ffmpeg -i video.mp4 -i audio.aac -c:v copy -c:a copy c_1.mp4

    Any assistance would be greatly appreciated.

    Ax
    Quote Quote  
  2. Perhaps you could clarify your naming convention a bit more (video.mp4, audio.acc) an whether you want to keep the audio track from video.mp4 (giving two audio tracks in c_1.mp4) or not.
    Quote Quote  
  3. Ret. Hippie Guitar Player Axel Slingerland's Avatar
    Join Date
    Jul 2020
    Location
    The Lost Coast
    Search Comp PM
    Sorry... I didn't think of that. The .mp4 files were originally .mov files from my camera, that the audio was recorded with the video, but was just the voices of my family. I converted them to .mp4 files and would like to drop the original audio and replace it with music I recorded.
    Quote Quote  
  4. Code:
    ffmpeg -i video.mp4 -i audio.aac -c:v copy -c:a copy -map 0:v -map 1:a c_1.mp4
    -map 0:v means take the video from the first input
    -map 1:a means take the audio from the second input
    Last edited by jagabo; 6th Jul 2020 at 08:01.
    Quote Quote  
  5. Ret. Hippie Guitar Player Axel Slingerland's Avatar
    Join Date
    Jul 2020
    Location
    The Lost Coast
    Search Comp PM
    Thanks! That explains something I didn't even realize I needed. Any suggestions on how to write the command into a batch file?
    Quote Quote  
  6. If your audio and video have the same base name (My Movie.mp4, My Movie.aac), to remux all file pairs in a folder:

    Code:
    md New
    for %%F in (*.mp4) do ( 
        ffmpeg -i "%%~nF.mp4" -i "%%~nF.aac" -c:v copy -c:a copy -map 0:v -map 1:a "New\%%~nxF"
    )
    pause
    The new files will have the same name as the video mp4 file but in a sub folder called New.
    Quote Quote  
  7. Ret. Hippie Guitar Player Axel Slingerland's Avatar
    Join Date
    Jul 2020
    Location
    The Lost Coast
    Search Comp PM
    Thanks again! It works like a charm. I had a feeling it would, because after looking around the forum and reading many posts looking for an answer before I posted my question (I know, I'm a rarity in that department) I was hoping you would reply. Kudos to you!
    Quote Quote  



Similar Threads

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