
Here the assumption is the audio is ahead of the video for three seconds. What happens is the second input which we take its audio starts with three seconds delay.
-map 1:a:0 – same as above, except it copies the audio of the second input to the output file. -map 0:v:0 – instructs FFmpeg to copy/map the video of the first input to the output file. -c:v copy – the same as the last, except for the video codec. If we want to can specify other codes like -c:a libmp3lame. -c:a copy – tells FFmpeg for audio codec just copy it. 3 literally means start the second input after three seconds of when the first input started. -itsoffset – this is an important parameter in this command because it instructs FFmpeg to add a delay of three seconds to the input streams. In our case, we have two files audio.mp3 and file.mkv, so we use two -i. It’s used to pass an input file to FFmpeg. It gets easy once you learn how each switch works. The way to run avidemux from command-line was learned by me from, although they do not mention the Python scripts, only the JS ones (which didn't work for me).$ ffmpeg -i file.mkv -itsoffset 3 -i file.mkv -c:a copy -c:v copy -map 0:v:0 -map 1:a:0 out.mkvĭon’t panic because of the lengthy command. It copies everything, but drops all but the needed audio track.
Then I ran a batch conversion of many files with a command like this one: for f in *.avi do avidemux3_cli -nogui -load "$f" -run.
I removed everything unrelated (a dozen of unneeded lines), and this is what I got in my some_series.py: #PY <- Needed to identify # I've looked at what kind of projects are saved as SpiderMonkey or TinyPy projetcs for my actions, and it turned out that the SpiderMonkey (JavaScript) project lacks the audio track selection actions which I needed, but the TinyPy (Python) project did have them. (In Avidemux GUI, as decribed in above, you simply select/unselect the audio tracks, and save the file.