==== transcode: ==== **Stablization** can be done using transcode as outlined [[http://isenmann.wordpress.com/2011/03/22/deshaking-videos-with-linux/|here]] and with more detail [[http://public.hronopik.de/vid.stab/features.php?lang=en|here]]. It's a 2-step process: create a .trf file with the information needed for transcoding:  transcode -J stabilize=shakiness=1 -i test.mp4 * shakiness is a number from 1 - 10. 10 means the video is really shaky so apply the filter with full force. 1 means don't do munch. Default is 5 and works well.  process the .trf file with the transform filter:  transcode -J transform=smoothing=1 -i test.mp4 -y xvid4 -w 6000 -o test.avi * smoothing sets a low-pass filter for applying the transform. The higher the smoothing value, the more filtering will appear to be happening (it's like raising the shakiness?) Default is 15 and works well. * -w sets the bitrate Default values work well for most uses, although boosting the framerate to about 6000 improves quality - somehow the audio gets distorted in the conversion. As a workaround, the audio can be added back in later: There's more detail on xvid4 transcoding with transcode [[http://www.transcoding.org/transcode?Examples_DVD_To_Xvid4|here]] it appears transcode gets "stuck" sleeping at the end of a transcode. There's a [[http://superuser.com/questions/101736/transcode-hangs-near-end-of-encoding|bash script hack]] for that problem. ==== ffmpeg ==== * rip audio:  ffmpeg -i "$file" -vn -ac 2 -ar 44100 -f wav $fileBase.wav * transcode a video file so it is playable through Windows Media Player (Windows) and Quicktime (MacOS): ffmpeg -i INPUT_FILE -b 1500 -ab 384k -cropleft 20 -cropright 20 OUTPUT.mpg * find framerate: ffmpeg -i $file 2>&1 | sed -n "s/.*, \(.*\) fp.*/\1/p" * make video from single image (example): ''ffmpeg -loop 1 -i image.png -c:v libx264 -t 15 -pix_fmt yuv420p -vf scale=320:240 out.mp4'' ([[https://stackoverflow.com/questions/25891342/creating-a-video-from-a-single-image-for-a-specific-duration-in-ffmpeg|source]]) * make video from a series of images (not necessarily numbered from 0000): ''cat *.jpeg | ffmpeg -f image2pipe -i - output.mkv'' then ''ffmpeg -i output.mkv -codec copy output.mp4'' //from [[https://stackoverflow.com/questions/22965569/convert-from-jpg-to-mp4-by-ffmpeg|this source]]// ==== filters ==== * crop: -filter:v "crop=1100:750:0:0" - crops the video to 1100x750 with starting location 0,0 * speed: -filter:v "setpts=0.5*PTS" makes video play 2x as fast. So as not to loose frames set -r 30 for 30 fps * to combine filters, use commas. Example: -filter:v "setpts=0.5*PTS, crop=1100:750:0:0" ==== codecs ==== * Don't leave it up to ffmpeg to pick a codec and quality because the quality will be very bad. * -codec:v libtheora seems pretty solid. Set the quality with qscale: -qscale:v 10 is the best quality whereas -qscale:v 2 is the worst. * -codec:a libvorbis teams up with libtheora well. -qscale:a 10 is the best audio quality