Skip to main content

Posts

Showing posts from December, 2014

ffmpeg , separating the audio from a video

If you ever wanted to grab the audio from any kind of video file, ffmpeg seems to be easiest way.   If you aren't familiar with ffmpeg,  it is a free software project that produces libraries and programs for handling multimedia data - on just about every operating system you can think of.  Amazingly powerful Swiss Army knife - this is just one of many things it can do. Below are some examples of extracting audio out of a video file.  (ffmpeg runs from the command line) In this example  i indicates the input ab indicates the bit rate (in this example 160kb/sec) vn means no video ouput ac 2 means 2 channels ar 44100 indicates the sampling frequency.  "video.m4v" is the full path to the video file  audio.mp3 is the audio file that gets created as an output ffmpeg -i "video.m4v" -ab 160k -ac 2 -ar 44100 -vn audio.mp3 In this example the -vn switch extracts the audio portion from a video and we are using the -ab switch to save the audio as a 256k

Converting mp4 to webm using ffmpeg for HTML5

I had to take a promotional video for work and make it available for a targeted marketing campaign.  The requirement was pretty simple, make it available to any HTML browser.  The challenge was the the original file was only made available as an MP4.  And we have no tools/budget to convert this to the other video formats HTML5 browsers may expect. What is the right way to convert video to encoding that works well in all HTML5 formats?  That depends, but I'll show you one way that worked for me in this case. After a little digging, seems it is really easy to get HTML5 video converted from an MP4 source video using FFMpeg from a command prompt in Windows.  I was successful using the examples below on Windows 8.1 For Webm I use the following. ffmpeg -i SourceVideo.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output.webm for ogv I use this. ffmpeg -i SourceVideo.mp4 -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5 output.ogv In this example, "SourceVide