Swap audio tracks in Xvid file

Well, this is more or less personal. Still interesting. Needed to batch-swap audio track of some video files (stuff I ripped from DVDs to play in iTunes, and stupidly I selected the german audio channel to play first). When I couldn’t find a tool doing that, I decided to just explore how it’s done with ffmpeg. And here’s the outcome:

{% highlight bash %}


list the available tracks

ffmpeg -i $1 2>&1 | grep Stream

printf “%s [%s]: ” “Enter audio track to use: ” “$OLDVAL”

for file in $filelist; do
ffmpeg -i $file -map 0:0 -map 0:${NEWVAL} -vcodec copy swap_$file
{% endhighlight %}

Notice: compact(): Undefined variable: limits in /var/www/virtual/acidix/nxhelp.com/wp-includes/class-wp-comment-query.php on line 821

Notice: compact(): Undefined variable: groupby in /var/www/virtual/acidix/nxhelp.com/wp-includes/class-wp-comment-query.php on line 821

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/virtual/acidix/nxhelp.com/wp-includes/class-wp-comment-query.php on line 399