Skip to content

Instantly share code, notes, and snippets.

@chssweb
Created July 26, 2012 13:01
Show Gist options
  • Save chssweb/3181917 to your computer and use it in GitHub Desktop.
Save chssweb/3181917 to your computer and use it in GitHub Desktop.
ffmpeg html5 links
##Video
AviDemux - Great all rounder(2.5 as 2.6 crashes all the time for me. Watch out for strange aac flutter at beginning of videos if you use this to encode the audio as well)
VirtualDub (the is a mp4 import plugin that is good, and the beta versions allow setting up external tools so mp4 output may be available http://code.google.com/p/ffinputdriver/downloads/list)
Avisynth - the beast of video manipulation (if you like scripting - see Doom9 forum for advice) (useful with a frameserver http://www.videohelp.com/tools/sections/video-frameservers)
SolveigMM AVI Trimmer + MKV 2 http://www.solveigmm.com/en/products/avi-trimmer-mkv/ (was freeware when I got it.) Seemed to be able to crop/trim MKV containers and edit a frame accuracy better than other tools (Still a last choice if avidemux etc work fine)
FFMPEG - great allinone encoder (see above notes)
Windows live movie maker is probably good as long as the conversion is a straight forward one.
##Audio
Audacity
NeroAAC to encode AAC (I use my media player foobar2000 as a convertor frontend for this)
aacgain (alternative to mp4 gain - losless normalisation of sound already muxed into an mp4)
##Container tools
Yamb and | or mp4box
mkvtoonix (for windows) - tools for MKV: has muxer frontend. Get http://sourceforge.net/projects/mkvextractgui-2/ for extract frontend
Optimise for web using mp4box, qt-faststart.exe, or while encoding (e.g. Handbrake option)
##Encoder frontends
Handbrake (nightly builds - ffmpeg frontend - mp4/mkv only)
avidemux |vdub
avanti (ffmpeg frontend)
smartFFmpeg (ffmpeg frontend)
FireOgg (ffmpeg frontend) http://firefogg.org/
@chssweb
Copy link
Author

chssweb commented Jul 27, 2012

I was reading the flash wiki and since 2009 at least it can play back mp4 files. So we shouldn't need to reencode to flv, and this player says it will automate the fallback if you provide just standard mp4 and webm html5 code - http://videojs.com/ so might be one to look for on wordpress

If we really need flv my first bet would be to batch remux the mp4 using:
ffmpeg -i INPUT -c:v copy -c:a copy OUTPUT.flv

I am almost at home with ffmpeg and the whole encoding thing now. Fantastic piece of kit, but way too much going on and the documentation is pretty awful.

As always the are plenty of blogs suggesting this and that, but a lot quite clearly have not bothered to understand the technology or the end user experience... but I am getting there

tbh with the presets now we can ignore a lot of the settings and use something like

ffmpeg -i input_file.avi -vcodec libx264 -vprofile high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -acodec libvo_aacenc -b:a 128k output_file.mp4

(from https://www.virag.si/2012/01/web-video-encoding-tutorial-with-ffmpeg-0-9/)

And even that is probably overkill - a even shorter version

ffmpeg -i input_file.avi -vcodec libx264 -vprofile high -preset slow -b:v 500k -acodec libvo_aacenc -b:a 128k output_file.mp4

-vcodec libx264 - tells it that we are doing h264 encoding.

To loose some quality but increase the speed -preset slow can be changed to medium or fast (never quicker or it will start to really tell)
To increase compatability with mobile devices (old ipods/iphones/underpowered androids) you could choose -vprofile baseline

The b:v and b:a are bitrates for video and audio (the v and a tag just makes it clear to ffmpeg which is which). If you leave things out like bitrate for audio it will be encoded as the original is.

Some useful audio settings (from http://howto-pages.org/ffmpeg/):
-ac 1
Tells ffmpeg to downmix the audio input to 1 audio channel (mono) instead of leaving it as the input (stereo, 2 channels).
-ar 44100
Tells ffmpeg to resample the audio at 44100 Hz instead of leaving it at 48000 Hz

If you prefer to keep the settings handbrake uses it’s a simple case of copy it cmdline window and checking out how it does things. One thing I noticed is that it is using older settings for some things...

Tools that come across well: avidemux for editing (and a lot more), avanti (not a looker but just about the right level of simplicity vs power), and smartffmpeg might be ok - need to add some user presets to make it really useful. The rest are either rubbish|too simple|full of spyware, or just way over the top (megui). Handbrake is great, but limited to mp4 really. Miro makes some poor decisions that cannot be changed.

I am putting a few of these in my euan folder on dropbox as some need extra files that are a devil to find...

qt-faststart.exe - this is the one that you should run on the mp4's to make them optimised for the web - moves the moov atoms (yeh I know - what?) to the head of the mp4 file making them quicker to load for apple products, flash. Its non-destructive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment