Simple video bash converter with ffmpeg

What do you need?

  • linux
  • ffmpeg
  • libx264
    • this is needed if you want to stream your videos, so that the audio streams are readable before the whole file is downloaded

Create a folder new and converted. Move your videos to the folder new and start the bash script below. When a file is converted the video is moved to the converted folder. As i said its a really simple script which should work for the most conversion. The video quality of this conversion is mostly like the original, but the file-size is reduced up to 50%.

#H264, aac, mp4, webusable
	video=" -f mp4 -vcodec libx264 -crf 28 -threads 0 -flags +loop -cmp +chroma -refs 3 -bf 3 -coder 1 -me_method hex -me_range 18 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 320 -keyint_min 25 -level 41 -qmin 10 -qmax 51 -qcomp 0.7 -trellis 1 -sc_threshold 40 -i_qfactor 0.71 "
	sound="  -acodec libfaac -ab 192k "
#start conversion
for f in new/*
		ffmpeg -i "$f" $video $sound -y "$f.mp4"
		python "$f.mp4"
		chmod a+r "$f".mp4
		mv "$f".mp4 converted
This entry was posted in Bash, ffmpeg, libx264, Linux, simpleScripts. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s