Archive

Archive for the ‘ffmpeg’ Category

php5-ffmpeg

November 9th, 2009 Arthur Gressick No comments

If your like me and want some really good tools for processing some videos using php take a look at this website:

http://ffmpeg-php.sourceforge.net/

If you have Linux (I use Ubuntu Server) then run this to install the software

apt-get install php5-ffmpeg

Converting MKV to iTunes Compatible [m4v/mp4]

October 28th, 2009 Arthur Gressick 4 comments

If your like me you like processing videos. I recently got a few MKV videos that are really awesome in quality and from what I can tell looks like the main format for Blu-ray videos. Now I am not saying that this post it aimed at converting videos illegally. You do what you want with this. I also am not giving you the end-all-be-all solution for every single MKV video. If your smart and work with this stuff then you will be able to figure out the videos that don’t quite work by tinkering with the settings.

First thing first, I have an Ubuntu 9.04 system running in 64-bit. I installed my ffmpeg from my posts (search ffmpeg, last posting). I am using an Intel Core2 Dou (not that this should matter).

Ok let’s get started. Let’s say my video is called Transformers2.mkv (Again, this is just an example, I love this movie). Also I am doing everything on the DESKTOP [/home/USER/Desktop]

Step 1. Installing additional apps using apt-get

sudo apt-get install mkvtoolnix gpac hexedit mplayer

Step 2. Reading the MKV file to see what you have.

mkvinfo Transformers2.mkv

NOTE: write down the FRAME rate of the video it might be weird like 23.976 or whatever, you will need it at the end.

NOTE: When you run this command you will see which tracks the video has. Let’s say in my case Track 1 is the h.264 portion and Track 2 is the audio.

Step 3. Separate the tracks. This will not eat up your CPU but your disk will run wildly.

mkvextract tracks Transformers2.mkv 1:video.h264 2:audio.ac3

Step 4. HEXEDIT the video file to be compatible with iTunes [m4v/mp4]

hexedit video.h264

On the first line you should see this number combination:
“67 64 00 33″
change this to:
“67 64 00 29″

NOTE: This might not be exactly what you see but close. In my case let’s say it was already what it needed to be changed to.

Step 5. Converting the Audio to AAC3 compatible. MKV’s typically encoded with audio that just won’t work with iTunes so we need to convert it to the something that it will understand. I am going to use ffmpeg to convert the audio.

ffmpeg -i audio.ac3 -acodec libfaac -ar 48000 -ab 448k -ac 6 -threads 0 audio.m4a

Step 6. Combining the video and audio tracks. Now here is where you need the frame rate from above.

MP4Box -add video.h264 -add audio.m4a -fps 23.976 Transformers2.mp4

Now once this is finished you should have a compatible video that will drag and drop right into iTunes. The video will not be much smaller then the original MKV as we did not convert or shrink the video just the audio. Check the beginning of the video or sync of sound and then the end of the video. It took me a couple of tries to get it in sync and also sounding really good. Have fun and hope this helps everyone out there.

Just a reminder I do not endorse stealing movies or ripping them, I just like to solve puzzles.

ffmpeg perfect mp4 recipe?

July 26th, 2009 Arthur Gressick No comments

We use the flowplayer flash player to display all of the videos on a site we built. The player can play h264 videos and this is the recommended recipe/formula for ffmpeg.

Original Post: http://flowplayer.org/forum/7/12671

ffmpeg -y -i trailerTest.mov -acodec libfaac -ar 44100 -ab 96k -coder ac -me full -me_range 16 -subq 5 -sc_threshold 40 -vcodec libx264 -s 1280x544" -b 1600k -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -i_qfactor 0.71 -keyint_min 25 -b_strategy 1 -g 250 -r 20 87.mp4

Make sure and read the post as there is a lot of information in there about different setups.

Categories: ffmpeg Tags: ,