Skip to content

Instantly share code, notes, and snippets.

@ThomasDalla
Created January 28, 2022 16:40
Show Gist options
  • Save ThomasDalla/5f9d941534bbeb614c16473c989f11ba to your computer and use it in GitHub Desktop.
Save ThomasDalla/5f9d941534bbeb614c16473c989f11ba to your computer and use it in GitHub Desktop.
Convert the audio of a single video into AAC, retaining original audio as well
#!/bin/sh
# Example: ~/tvshow.sh file-without-extention mkv mp4
input="$1.$2"
output="$1.$3"
echo "$input --> $output"
if [ -f "$input" ];
then
ffmpeg -hide_banner -i "$input" -map 0:v -c:v copy -map 0:a -c:a copy -map 0:a:0 -c:a:0 aac -map 0:s -c:s mov_text -map_metadata 0 -movflags +faststart "$output" && \
rm "$input"
else
echo "$input does not exist"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment