Skip to content

Instantly share code, notes, and snippets.

@igor-kamil
Last active November 12, 2019 10:35
Show Gist options
  • Save igor-kamil/3d29d26716df9a6ba9fbb3f569994f19 to your computer and use it in GitHub Desktop.
Save igor-kamil/3d29d26716df9a6ba9fbb3f569994f19 to your computer and use it in GitHub Desktop.
bash script to convert MXF files to MP4 with deinterlacing and preserving the quality
#!/bin/bash
# based on http://www.arj.no/2019/11/03/converting-mxf-files-to-mp4-with-ffmpeg/
mkdir -p ./compressed
for i in *.mxf; do
if [ -e "$i" ]; then
file=`basename "$i" .mxf`
# MP4 file with default settings + deinterlacing
# ffmpeg -i "$i" -c:v libx264 -vf yadif "$file.mp4"
# MP4 file with high quality + deinterlacing + compatible with quicktime
ffmpeg -i "$i" -c:v libx264 -crf 20 -c:a aac -pix_fmt yuv420p -vf yadif "./compressed/$file.mp4"
# same as above but mix audio to mono
# ffmpeg -i "$i" -c:v libx264 -crf 20 -ac 1 -c:a aac -b:a 320k -pix_fmt yuv420p -vf yadif "./compressed/$file.mp4"
# Create uncompressed audio file
# ffmpeg -i "$i" -acodec pcm_s16le "$name_conv.wav";
# Create thumbnail from the first image in the video file
# ffmpeg -i "$i" -vf "thumbnail" -frames:v 1 "$file.png"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment