Skip to content

Instantly share code, notes, and snippets.

@AndyA
Created November 16, 2014 13:49
Show Gist options
  • Select an option

  • Save AndyA/ddc5321336c99c9cff82 to your computer and use it in GitHub Desktop.

Select an option

Save AndyA/ddc5321336c99c9cff82 to your computer and use it in GitHub Desktop.
MJPEG Odyssey Encoder
#!/bin/bash
in="MP4"
out="/Volumes/Solar/Tom/MJPEG"
find "$in" -iname '*.mp4' | while read mp4; do
avi="$out/$( basename "$mp4" .mp4 ).avi"
if [ "$mp4" -nt "$avi" ]; then
echo "$mp4 -> $avi"
mkdir -p "$( dirname "$avi" )"
tmp="$avi.tmp.avi"
ffmpeg \
-i "$mp4" \
-vf "scale=1440:1080,pad=1920:1080:240:0" \
-metadata:s:v:0 rotate=0 \
-pix_fmt yuvj422p \
-c:a pcm_s16le \
-c:v mjpeg -q:v 1 -r:v 25 \
-aspect:v 16:9 \
-y "$tmp" < /dev/null && mv "$tmp" "$avi"
fi
done
# vim:ts=2:sw=2:sts=2:et:ft=sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment