Skip to content

Instantly share code, notes, and snippets.

@jnsprnw
Last active May 11, 2017 08:30
Show Gist options
  • Select an option

  • Save jnsprnw/f8f4228c49e59932fdac3e0399c350d9 to your computer and use it in GitHub Desktop.

Select an option

Save jnsprnw/f8f4228c49e59932fdac3e0399c350d9 to your computer and use it in GitHub Desktop.
Converter settings for CH Post

Install FFmpeg

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265

Webvideos

<video controls>
  <source src="somevideo.webm" type="video/webm">
  <source src="somevideo.mp4" type="video/mp4">
  I'm sorry; your browser doesn't support HTML5 video in WebM with VP8/VP9 or MP4 with H.264.
  <!-- You can embed a Flash player here, to play your mp4 video in older browsers -->
</video>

https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats

Webm

https://trac.ffmpeg.org/wiki/Encode/VP8

ffmpeg -i list0main-de.mov -vcodec libvpx -qmin 0 -qmax 50 -crf 2 -b:v 2M list0main-de.webm
for f in *.mov;do ffmpeg -i "$f" -vcodec libvpx -qmin 0 -qmax 50 -crf 2 -b:v 2M "${f%mov}webm";done

OGV

https://trac.ffmpeg.org/wiki/TheoraVorbisEncodingGuide

ffmpeg -i list0main-de.mov -codec:v libtheora -qscale:v 5 list0main-de.ogv
for f in *.mov;do ffmpeg -i "$f" -codec:v libtheora -qscale:v 5 "${f%mov}ogv";done

MP4

https://trac.ffmpeg.org/wiki/Encode/H.264

ffmpeg -an -i list0main-de.mov -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 list0main-de.mp4
for f in *.mov;do ffmpeg -an -i "$f" -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 "${f%mov}mp4";done

Regular videos

Convert to 720p

https://trac.ffmpeg.org/wiki/Scaling%20(resizing)%20with%20ffmpeg

for f in *.mov;do ffmpeg -i "$f" -vf scale=1280:720 "${f%.mov}-720.mov";done

Modern mp4 (h264)

https://trac.ffmpeg.org/wiki/Encode/H.264

ffmpeg -i PostCH_2016_DE.mov -f mp4 -vcodec libx264 -preset veryslow -crf 20 -pix_fmt yuv420p -acodec aac PostCH_2016_DE-Pixel.mp4 -hide_banner
ffmpeg -i PostCH_2016_DE.mov -f mp4 -vcodec libx264 -preset veryslow -crf 20 -pix_fmt yuv420p -acodec aac PostCH_2016_DE-Pixel.mp4 -hide_banner

Old school avi (mpeg-4)

https://trac.ffmpeg.org/wiki/Encode/MPEG-4

ffmpeg -i PostCH_2016_DE.mov -c:v mpeg4 -vtag xvid -qscale:v 4 -c:a libmp3lame -qscale:a 4 PostCH_2016_DE.avi
for f in *.mov;do ffmpeg -i "$f" -c:v mpeg4 -vtag xvid -qscale:v 4 -c:a libmp3lame -qscale:a 4 "${f%mov}avi";done

Future shit h265

https://trac.ffmpeg.org/wiki/Encode/H.265

ffmpeg -i PostCH_2016_DE.mov -c:v libx265 -preset veryslow -crf 28 -c:a aac -b:a 128k -pix_fmt yuv420p PostCH_2016_DE-265.mkv
for f in *.mov;do ffmpeg -i "$f" -c:v libx265 -preset veryslow -crf 28 -pix_fmt yuv420p -c:a aac -b:a 128k "${f%mov}mkv";done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment