Recent News

Random FFmpeg and Mencoder Commands

Posted by Root on October 7th, 2009

I keep a list of all the FFmpeg / Mencoder command that I come across on the Internet and add it to my Knotes for future refernce, Today I am sharing the list. The credit goes to all the website and forums which I have come across to build this nice little list of FFmpeg / Mencoder commands.
Capture video of a linux desktop
$ ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out

Convert other video to FLV
$ ffmpeg -i video.avi -ar 22050 -ab 32 -f flv -s 320×240 video

Download YouTube videos as .flv and convert them to .3gp for your mobile phone.
$ ffmpeg -i file.flv -r 15 -b 128k -s qcif -acodec amr_nb -ar 8000 -ac 1 -ab 13 -f 3gp -y out.3gp

Extract audio and video from a file
$ ffmpeg -i source_movie.flv -vcodec mpeg2video target_video.m2v -acodec copy target_audio.mp3

Convert bunch off oggs to mp3
$ for x in *.ogg; do ffmpeg -i “$x” “`basename “$x” .ogg`.mp3″

AAC conversion
$ ffmpeg -i source.mp3 -acodec libfaac -ab 128k dest.aac
iPod / iPhone
$ ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 320×180 -title X output.mp4
convert-almost-any-image-into-a-video
$ ffmpeg -loop_input -f image2 -r 30000/1001 -t $seconds -i frame/$num.ppm -y frame/%02d.mpeg 2>/dev/null

Record MP3 audio via ALSA using ffmpeg
$ ffmpeg -f alsa -ac 2 -i hw:1,0 -acodec libmp3lame -ab 96k output.mp3

Convert files to xvid

$ mencoder “$1″ -ofps 23.976 -ovc lavc -oac copy -o “$1″.avi

Covert wmv to avi
$ mencoder “/path/to/file.wmv” -ofps 23.976 -ovc lavc -oac copy -o “/path/to/file.avi”
Merge video files together using mencoder (part of mplayer)
$ mencoder -oac copy -ovc copy part1.avi part2.avi part3.avi -o full_movie.avi
Encode a file to MPEG4 format
$ mencoder video.avi lavc -lavcopts vcodec=mpeg4:vbitrate=800 newvideo.avi

Convert mp3/wav file to asterisk ulaw for music on hold (moh)
$ sox -v 0.125 -V <mp3.mp3> -t au -r 8000 -U -b -c 1 <ulaw.ulaw> resample -ql

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon] none

Converting mp3 files to iPhone ringtones in Linux

Posted by Root on March 31st, 2009

I got a couple of emails a while ago about  people who were interested in creating ring tones for the  iPhone, Well since I do not own an iPhone or have any intentions of having one I have instead found a nice little how to guide for those interested in the subject …..read more.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon] none

Creating small size ring tones

Posted by Root on February 28th, 2008

When you are in the business of selling ring tones there are certain elements that make it difficult to ensure 100% content delivery and with the added pressures to use DRM. The main issue which we will be looking at in this post will be the size issue, There are various ways to try and reduce the size of your ring tone to allow for easy downloading for instance changing the bit-rate , changing the format(encoding) or just shorting the ring tone length. All the methods I just mentioned work but at a compromise to the quality or length of the ring tone. My solution is no different at all to the suggestions above but at least the quality will still be decent for the phone and the length will still be a full track.

Most ring tones in the market are of mp3 quality(true tone) but it is not easy to download a full track mp3 song on the mobile phone yet, The technology is getting better but it is still very much unstable. An alternative to the mp3 download is to use amr encoding which offers good quality at a small file size, It is not cd quality but it is still decent for the mobile phone. You can offer this as alternative download option to your already mp3 or wma ring tone formats.

With amr you can lower the file size e.g. 3 mega bytes full track(mp3) to 500 kilo bytes full track (amr). The only thing you might have to be careful about would be to check if the particular mobile phone does support amr format first before giving it the file because this can cause problems for you with users complaining about downloads not working. If you do not know how to perform checks on the phone – I would suggest you read my other previous post about achieving this feature – detecting mobile devices on your website .

Lets start converting.
Please Note: This post assumes you have Ffmpeg installed and configured on your machine,if you do not know what I mean please read the Ffmpeg section on the site.

/user/bin/ffmpeg -y -i ring.mp3 -ac 1 -ab 12.2k -ar 8000 -f amr -acodec libamr_nb ring.amr

That is all it takes to get the amr conversion working, you might want to play around with these options -ac 1 -ab 12.2k -ar 8000
until you find the right quality and size for you. Please read about the amr options available for use with Ffmpeg and what values can be or cannot be changed.

That’s it folks, I will try to cover the DRM section next time for those who do not know how to use it.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Tags: , , ,

Converting mp3 to flv with ffmpeg

Posted by Root on September 24th, 2007

Sometime last year I encountered a problem with playing mp3 flies online, The problem I had was the player which I had embedded on the page only worked for windows machines which was a problem because I work on a Linux machine all the time. I then decided to convert the mp3 files to a flv format and use a flv player on the site,this setup allowed for songs to be played on site via a flash player which worked on a Windows,Linux and Mac environments as long as the browser supported flash.

The code that did the trick:

ffmpeg -y -i myfile.mp3 -f flv -acodec libmp3 -ab 64 -ac 1 myfile.flv

This is useful if you are running a music site of some sort where you want to make sure that users can listen to the site music files online regard less of what operating system they are running.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Tags: , ,

Converting mp3 to amr with ffmpeg

Posted by Root on September 6th, 2007

Lets start by checking if you have amr support enabled with ffmpeg, Type ffmpeg in you console to check if it is in your $PATH Or preferable you can run it from where it is installed e.g /usr/local/ffmpeg/bin/ffmpeg

When I run my ffmpeg without any parameters this is what I get.

FFmpeg version SVN-r9833, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: –enable-shared –enable-gpl –enable-pp –enable-liba52 –enable-libamr-nb –enable-libamr-wb –enable-libfaac –enable-libfaad –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-libx264 –enable-libxvid –disable-mmx –enable-libtheora

Which means I have both versions of amr installed. For the sake of demonstration I a m going to use libamr_wb which is what I need to create true tones from mp3, Just remember you can use other formats besides amr to create ring tones.

ffmpeg -y -i myaudio.mp3 -ab 18.25k -ar 16000 -acodec libamr_wb -ac 1 mynewaudio.amr 2>&1

Be careful on which libamr you decide to use because they accept sampling rates which are very different, If you upload this to your phone it should play. The One nice thing about using amr is that you can cut down on the mp3 file size by more than 200% e.g. take a mp3 song which is 2.5mb in size and you convert that with the settings given above, you will have an amr file which is roughly at 500kb in size and it is still a full length song but just the quality is not as good as mp3. For best results try to play around with bit rate(-ab) variables.

Please note that some cellphones don’t support amr, so you will still have to try out other formats for them.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Tags: , ,

Recent Comments | Recent Posts


designed by: Website Builder | Coded by: Blog Directory | Provided by: Wedding photojournalism chicago
bottom