Wed 19 Apr 2006
Convert other video to FLV
-i input file name
-ar audio sampling rate in Hz
-ab audio bit rate in kbit/s
-f output format
-s output dimension
Convert other video to FLV with metadata
You have to install flvtool2, too, see my previous post
Convert FLV to jpg sequence
-i Input file name
-an disable audio
-r fps
-y overwrite file
-s output dimension
Convert particular frame to jpg
-ss record start time
-t record end time last for
So if you want to save frame 4 (00:00:04) -ss 00:00:03 -t 00:00:01. Note: it is count from 00:00:00. Even you want to save one jpg, you still need to use %d for naming, it is strange that I grab one frame for one second, it will return two identical jpg files for me
Related Article
Other Reference
- FLV Encoding with FFmpeg
- Converting 3GP video files HOWTO
- Video Blogging using Django and Flash(tm) Video (FLV)

April 20th, 2006 at 12:00 am
What if I want to convert multiple JPGs in FLV? At the same time how would I add wav or mp3 to it?
Thanks,
Ali
April 20th, 2006 at 4:50 am
Hey yeah I found that the “ar 22050″ is the really important part when dealing with flvs. I made a c# service which listens to a mailbox and picks up the video files and adds them to a website, works really nicely.
June 7th, 2006 at 12:09 pm
Thx
June 13th, 2006 at 3:09 am
I’ve been using ffmpeg to grab frames using the following syntax, it doesn’t require the %d in the filename.
ffmpeg -i input.flv -an -ss 00:00:01 -r 1 -vframes 1 -s 400×300 -f mjpeg -y output.jpg
June 13th, 2006 at 3:09 am
adjust the -ss to the time you want to grab the frame and the -s option to the size of the jpeg you want.
September 1st, 2006 at 11:08 am
thanks for your guide of converting video to FLV, i have known this, thanks again!
October 31st, 2006 at 2:53 pm
ffmpeg -i video.avi -ar 22050 -ab 32 -f flv -s 320×240 video.flv
Hi all,
The above coding is converting .avi to
.flv file but the .flv file is not running. I dont know the reason. Any one can help me
December 11th, 2006 at 7:39 pm
Hi all,
I am trying to convert .avi video to flv using the command
ffmpeg -i football.avi -ar 22050 -ab 32 -f flv -s 320×240 - | flvtool2 -U stdin video.flv
I installed all the steps which was mentioned in http://luar.com.hk/blog/?p=669
I am getting the error, while running the above command. So please can any one help me rectify the error.
Error was:
Input #0, avi, from ‘football.avi’:
Duration: 00:00:22.0, bitrate: 261 kb/s
Stream #0.0: Video: msmpeg4v1, 224×160, 25.00 fps
Stream #0.1: Audio: pcm_s16le, 8000 Hz, mono, 128 kb/s
Output #0, flv, to ‘pipe:’:
Stream #0.0: Video: flv, 320×240, 25.00 fps, q=2-31, 200 kb/s
Stream #0.1: Audio: mp3, 22050 Hz, mono, 32 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
/usr/local/lib/site_ruby/1.6/1.6/flvtool2/base.rb:280:in `create_directories_for_path’: undefined method `inject’ for # (NameError)
from /usr/local/lib/site_ruby/1.6/1.6/flvtool2/base.rb:198:in `process_files’
from /usr/local/lib/site_ruby/1.6/1.6/flvtool2/base.rb:44:in `execute!’
from /usr/local/lib/site_ruby/1.6/1.6/flvtool2.rb:168:in `execute!’
from /usr/local/lib/site_ruby/1.6/1.6/flvtool2.rb:228
from /usr/bin/flvtool2:2:in `require’
from /usr/bin/flvtool2:2
Any one help me.
December 22nd, 2006 at 4:51 am
I’m using ffmpeg to convert to FLV, but for some reason there is no sound in the output file. I’m using this command:
ffmpeg -i file.avi -ar 22050 -ab 32 -f flv -s 320×240 file.flv
Which yields this output:
FFmpeg version SVN-r6147, Copyright (c) 2000-2004 Fabrice Bellard
configuration: –cc=gcc-3.3 –enable-shared –enable-pthreads –disable-vhook
libavutil version: 49.0.0
libavcodec version: 51.12.0
libavformat version: 50.5.0
built on Sep 1 2006 12:29:40, gcc: 3.3 20030304 (Apple Computer, Inc. build 1819)
Input #0, avi, from ‘brad.avi’:
Duration: 00:00:06.1, start: 0.000000, bitrate: 2172 kb/s
Stream #0.0: Video: mjpeg, yuvj420p, 320×240, 17.04 fps(r)
Stream #0.1: Audio: pcm_s16le, 22050 Hz, mono, 352 kb/s
File ‘brad.flv’ already exists. Overwrite ? [y/N] y
Output #0, flv, to ‘brad.flv’:
Stream #0.0: Video: flv, yuv420p, 320×240, q=2-31, 200 kb/s, 17.04 fps(c)
Stream mapping:
Stream #0.0 -> #0.0
[flv @ 0x1283008]removing common factors from framerate
Press [q] to stop encoding
frame= 105 q=7.6 Lsize= 235kB time=6.2 bitrate= 313.0kbits/s
video:234kB audio:0kB global headers:0kB muxing overhead 0.770648%
Any help is appreciated!
January 19th, 2007 at 11:09 pm
Thanks a lot! No need to purchase expensive encoder solutions!
February 15th, 2007 at 7:24 am
Yay! So many sources on the net for grabbing a single frame using ffmpeg and none of them work, yours does!
Thank you!
February 17th, 2007 at 3:19 pm
[...] ffmpeg -i “youtubefilename.flv” -b 900 -ab 96 outputfilename.mpg (For converting mpg, avi TO flv or flv TO jpg picture try this guys FAQ:link) [...]
February 21st, 2007 at 7:55 am
to get just one frame set the option: -vframe 1
February 25th, 2007 at 12:18 am
ffmpeg -i video.flv -an -ss 00:00:03 -t 0.001 -r 1 -y -s 320×240 video.jpg
will make only one frame and you wont need %d
March 3rd, 2007 at 3:25 am
Thanks for the guide!
Really appreciate it. Now i can finally ditch youtube and use my own flv-player.
March 17th, 2007 at 6:31 pm
Thanks for the great guide.
I converted ‘.mpg’ to ‘.flv’ and it works great, but there is no sound.
Any ideas?
March 21st, 2007 at 7:57 am
First let me tell you …
You guys simply rock…
Still everyone have problem converting video using ffmpeg with audio.. I thought I would share my expertise in this problem…
First of all .. I am using windows server it might be little different for some of you guys..
but this is what commands you can use… in sweet PHP
But before you use this command .. you need to download riva encoder under windows.. install it on your system (once you install it copy two files into plugin directory)or may be just extract two files out of installer called ffmpeg.exe and flvtool2.exe and then copy it under your webserver or somewhere behind your webserver root directory.. and just simply call it through your php file..
You can simply use precomplied files for your linux OS and then store it under the path and use it as a shell command…
This command is same as c or c++ exec
For those we are using this first time.. It is basically use to run executable files under any operating system.. On windows exe and on linux a.out…
Under windows..
// First command will convert video to flv format .. and also include audio to it…
exec(”path to /plugins/ffmpeg-win32/ffmpeg/ffmpeg -i path to input/brachial/TheKnack.mpg -b 500 -r 25 -s 320×240 -hq -deinterlace -ab 56 -ar 22050 -ac 1 path to output/brachial/TheKnack.flv 2>&1″, $output);
// This command will add meta tags to the flv files using flvtool2..
exec(”path to/plugins/ffmpeg-win32/ffmpeg/flvtool2 u path to in and same output file/brachial/TheKnack.flv 2>&1″, $output);
foreach($output as $outputline){
echo(”$outputline”);
}
This will have both audio and meta tags into converted FLV file…
If you still have any problem regarding this please contact me through email aniketmehta at yahoo dot com and i will be happy to help you with this…
Thanks.
Aniket Mehta.
To solve audio problem, you need to compile ffmepg with required audio codes.. Under windows riva already have this done for you…
Remember this is just for research or study purpose.. No other intention is explicitly expressed or implied.
April 6th, 2007 at 1:33 am
Amazing tutorial, really much more than i expected, but there is a sound (audio codec) problem i had encountered;
[root@roxxi ffmpeg]# ffmpeg -i paris.avi -ar 22050 -ab 32 -f flv -s 320×240 paris.flv
ffmpeg version 0.4.9-pre1, build 4718, Copyright (c) 2000-2004 Fabrice Bellard
built on Apr 5 2007 17:13:13, gcc: 3.4.6 20060404 (Red Hat 3.4.6-3)
Input #0, avi, from ‘paris.avi’:
Duration: 00:00:05.3, bitrate: 2386 kb/s
Stream #0.0: Video: mjpeg, 320×240, 15.00 fps
Stream #0.1: Audio: pcm_u8, 11024 Hz, mono, 88 kb/s
Output #0, flv, to ‘paris.flv’:
Stream #0.0: Video: flv, 320×240, 15.00 fps, q=2-31, 200 kb/s
Stream #0.1: Audio: 0×0000, 22050 Hz, mono, 32 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
[flv @ 0x8219388]removing common factors from framerate
Unsupported codec for output stream #0.1
April 6th, 2007 at 1:34 am
please help me to solve this “unsupported codec fot output stream #0.1″ error.
April 6th, 2007 at 9:42 pm
well, my problem is solved after i download ffmpeg from svn.
a little advice:
don’t use ffmpeg 0.4.9. pre1 for the version, seems to be old and has some audio codec problems.
April 11th, 2007 at 9:41 am
Yes, this is fantastic. I do have one question, when I convert to flv how to get the best quality? The quality of the flv’s is not good at all, am I doing something or not doing something I should or should not be?
Did I say this is fantastic? Thanks.
May 15th, 2007 at 6:34 am
Just thought id mention that when setting the -b option, it needs it in bit/s - so for an flv to be saved at 512kb/s, you need to use ‘-b 512000′…
Took me a while to notice this in the documentation and I was really confused why my vids were always really low quality.
May 17th, 2007 at 8:11 am
What about making a FLV with a series of .tif or jpeg images?
May 27th, 2007 at 11:50 pm
[...] FFmpeg usage command [...]
June 5th, 2007 at 6:05 pm
[...] Site Refer : http://luar.com.hk/blog/?p=670 ================================= [...]
June 19th, 2007 at 6:33 pm
I need help, how to crop video of 30 second using ffmpeg.. any one genious know the command to do it. i m totaly new in ffmpeg..
Regards
July 20th, 2007 at 4:56 pm
javaid use -t 00:00:30
`-t duration’
Set the recording time in seconds. hh:mm:ss[.xxx] syntax is also supported.
`-fs limit_size’
Set the file size limit.
July 30th, 2007 at 9:37 pm
Hi,
I want to convert .avi to .flv
For that i have used following commandline
ffmpeg -y -i “Video.avi” -r 5 -b 512000 -g 15 -ar 44100 -ab 224k -f flv “Video.flv”
My problem is that the video quality of “video.flv” is not same as “video.avi”.
plz note that video.avi is screen captured video(The current activity of desktop)and resolution is current system’s resolution(i.e 1024×768)
Image in my output FLV file is blurred(Text is not clearly readable,but picture quality is good).
Can anyone help me in this regard?
Which parameters i should pass to FFMPEG to get better video quality?
I have also tried with -b 2496..but there is not much diffrence.
July 31st, 2007 at 7:29 am
I am having the same problem as a posted above… I’m getting the following output:
frame= 133 q=2.0 Lsize= 204kB time=5.3 bitrate= 314.5kbits/s
video:202kB audio:0kB global headers:0kB muxing overhead 1.034389%
Is there any way to test to see if the LAME codec installation is successful? I think that may be the issue here. Thanks in advance!
August 10th, 2007 at 6:12 pm
Can we get jpg image from wmv file?
Please send the code to generate jpg image of wmv file.
Thanks
August 16th, 2007 at 4:03 am
Zehra: try increasing your frame rate -r 15 -g 30
right now you’re doing 5fps. (-r 5)
larger files but better clarity.
September 18th, 2007 at 4:48 pm
Hi, When I was trying to convert video to flv, first upload and then submit, it is converting to flv fine, but during the conversion it is opening the download option for open /save /cancel, means, it is giving the output the streaming details, how Can I stop that?
Means I want just upload and convert that by ffmpeg and it is redirecting to flash player.
Give suggestion,
September 26th, 2007 at 11:03 pm
hai
i want to compressing the video/audio file, which command is support decoding process?
October 10th, 2007 at 3:52 pm
Nice collection of hard to find answers!!!
My problem concerns nellymoser codec.
Is there a way to pump into an flv an mp3 stream (Over writing the old one) & not destroying the video??
Cant seem to find a way to do it either using flvtool or ffmpeg
Help is appreciated
October 12th, 2007 at 1:21 am
FLV to mp3, you can check this one:
http://www.thoughtcrime.org/software/nellynomore/index.html
November 3rd, 2007 at 2:51 pm
I was facing the same audio problem. Video converted without any audio. Of course we do not have lame installed but don’t ffmpeg has its own default codecs. We have not mentioned any encoder in command options.
More over, if we download and configure lame, usr/bin, will it be detectable by ffmpeg or some thing more will be required ?
Thanks and Regards
November 26th, 2007 at 6:44 pm
I found this blog site very informative in regards to FFmpeg.
I was trying to add the meta data like author, comments, title, copyright but I have to go for converting the file completely to another format instead of just setting these data in the same file.
Any suggestions from your side will be good for me.
I need to set the author for all formats of videos files supported by FFmpeg
November 27th, 2007 at 9:20 pm
Hi, i want to convert various image formats(.png, .bmp, .tiff,…) to .jpg file format. how to convert using ffmpeg, or other methods… can u please tell me the solution else suggession.
Thanks,
Irai
December 18th, 2007 at 7:54 pm
trying to convert audio only flv to wav!
what could be a possible syntax?
ffmpeg -i abc.flv -ab 192 -o abc.wav
is not working!
–regards,
Mohammad Ali
mohammadali110@gmail.com
January 13th, 2008 at 6:59 pm
yes you can get jpg from wmv: do this:=>
ffmpeg -i $uploaded_video_file_flv -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -s 320×240 -vcodec mjpeg -f mjpeg $path_to_jpg_file”;
January 18th, 2008 at 6:58 pm
Hi all,
I’m trying to export a frame from a list of flv. It works fine using:
ffmpeg -i *.flv -t 00:00:15 -ss 00:00:10 -vframes 1 -s 32×24 %d.jpg
But i want to keep the original name from the flv file for the jpg. I don’t know how to do it anyone knows how it works?
many thanks,
makisho
January 28th, 2008 at 10:25 pm
[...] FFmpeg usage command [...]
January 31st, 2008 at 12:25 am
Thanks for this. I use ffmpeg its powerfull
March 8th, 2008 at 12:21 am
I often get a serious ecoder issue - some of the .avi files I send are encoded with a greyscale (no colours) and the video is leaning to the right
March 27th, 2008 at 11:38 pm
Yay, I solved the problem with audio on Ubuntu 7.10. The trick was to add medibuntu repository and install updates. Than ffmpeg converted video with audio.
It seems that default ffmpeg is not compiled with mp3 support.
http://www.medibuntu.org/
March 31st, 2008 at 8:29 am
[...] thanks http://www.luar.com.hk/blog/?p=670 [...]
April 11th, 2008 at 3:59 am
converting 3gp or mp4 to .FLV
any ideas?
this link http://julian.coccia.com/blog/index.php?p=66&more=1
doesn’t work properly and kinda old.
Thanks in Advance.
April 14th, 2008 at 4:28 am
A manual to ffmpeg would be nice. I have yet to see a full manual for this wonderful program, explaining all codecs etc…(but I have found tons of homepages, asking for how to use this program)…
May 11th, 2008 at 8:06 pm
Thanks for these nice examples. Hope you can continue to put up such good examples in the future, I am going to “bookmark” your blog
June 12th, 2008 at 5:00 pm
Hi all,
My project needs the audio format conversions.
For the purpose i am using ffmpeg.exe and faad.exe.
I am working on Windows XP, but my client’s opeating system is Open
Solaris.
I just needed to know whether this ffmpeg.exe and faad.exe would work
fine on Open Solaris also along with thier system commands.
I am working with ruby on rails 2.0.2…
June 24th, 2008 at 12:30 am
Is there a way to convert a sequence of images to video ? Or even better have a sequence of images and audio wrapped together as video ?
I’ve using ffmpeg for FLV and Mp3 encoding but wondering if its possible to do the mentioned above
June 25th, 2008 at 12:05 am
@51 Mario
You can take a look image2mpeg
June 26th, 2008 at 2:21 am
Cool, thanks! I will definitely check it out
July 30th, 2008 at 9:22 am
Hello Luar,
Thanks so much for your distillation of the seemingly daunting ffmpeg program. It works a treat for avi to flv. I’m now attempting to convert a .flm file to .flv, or any format I can, as an intermediate step, and then to .flv. Do you know if this is possible?
August 1st, 2008 at 7:42 pm
I want to take 30 frames from a 46:23 min movie (25 fps)
How can I manipulate the -r switch to do this?
August 9th, 2008 at 5:42 am
i want to make all the captured jpeg thumbnails into one files. more like a image grabber 2 version of the windows software
how can i achieve that?
August 30th, 2008 at 10:14 am
hello,
Iam converting the .mov fie to .flv file.
But the problem is, it can not be convert to flv .No output comes.
Just an empty page come.
I checked my php.ini.the FFMPEG must be enabled.
Iam using the following code for conversion.
function converttoflv( $in, $out )
{
$cmd = exec(”ffmpeg -i $in -deinterlace -ar 44100 -r 25 -qmin 3 -qmax 6 $out”);
}
Please I need the quick and Kind reply as soon as possible…
Thanks and regards
Manikandan.T
January 30th, 2009 at 3:57 am
[...] Yet Another Blog from Luar » FFmpeg usage command Says: July 28th, 2006 at 4:59 am […] Video Blogging using Django and Flash(tm) Video (FLV) […] [...]
February 5th, 2009 at 6:19 am
Hi, your guide about ffmpeg solved just a part of my problem (about 50%).
Now I’m trying to create an flv file using just a jpeg file as frame.
If I use this command:
ffmpeg -i img.jpg movie.flv
I obviously obtain an flv file made by 1 frame. How can I repeat that image to have a 30 seconds movie? Can you help me please?
Thanks
February 21st, 2009 at 3:13 am
[...] http://luar.com.hk/blog/?p=670 Uncategorized ffmpeg, flash, flv, red5, ubuntu 8.04, video, video convertion, video streaming [...]
March 7th, 2009 at 12:06 am
Hello,
I saw you guys are talking aboout converting different kind of video files in FLV. The best way to do it is to get a verified software and to upload your video to a server. Then an encoding software can do the rest and all you need to do is to login into an account and download the new generated file. Various video extensions can be encoded.
April 3rd, 2009 at 3:35 pm
Thanks so much for your post! Very helpful.
When converting from asf/wmv to flv I did get some errors that worried me like “output buffer too small” followed by “Audio encoding failed”, but the audio seemed to work just fine and according to a couple Google queries these specific errors can be safely ignored.
Thanks again!
April 16th, 2009 at 8:29 pm
[root@130 ~]# php -r ‘phpinfo();’ | grep ffmpeg
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/ffmpeg.so’ - /usr/lib/php/modules/ffmpeg.so: undefined symbol: img_resample in Unknown on line 0
May 3rd, 2009 at 3:27 pm
Well after a long run i got the solution
this error means your ffmpeg-php rpm is corrupted so i have just uninstall the previous all rpms of ffmpeg-php.
step 1
see how many rpms are there for ffmpeg-php on you system by this comand
rpm -qa | grep php
then uninstall the only ones having php-ffmpeg one by one
rpm -e php-ffmpeg-0.5.1-2.fc8.remi –nodeps
then WGET new one from here
http://rpm.pbone.net/index.php3/stat/4/idpl/12277480/com/ffmpeg-php-0.5.1-1.fc7.remi.i386.rpm.html
rpm -ivh ffmpeg-php-0.5.1-1.fc7.remi.i386.rpm
install it and it will work fine
October 28th, 2009 at 3:59 pm
i am using the following for converting avi to flv file
” -i ” + video.avi + ” -s 480*360 -deinterlace -ab 32 -r 15 -ar 22050 -ac 1 ” + mpg.flv;
it is converting avi file which is less than 1 MB but it is not converting 3-4 MB file.
July 11th, 2010 at 9:27 pm
Hi, Anyone can guide be how to be able to seek videos upload. I can upload and convert from mpg to flv fine, I have updated the metadata with flvtool2 and now i can see the duration. But I can seek when playing the video.. Please need some help. Thanks
July 11th, 2010 at 9:31 pm
Got it to work.
exec(’ffmpeg -i ‘.$uploadfile.’ -f flv -s 1280×720 -r 15 -g 30 ‘.$new_flv.”);
exec(’ffmpeg -i ‘.$uploadfile.’ -f mjpeg -ss 20 -vframes 1 -s 554×400 -an ‘.$new_image_path.”);
exec(’flvtool2 -U ‘.$new_flv.”);
August 11th, 2010 at 3:41 pm
Converting other video to FLV made with online free tools.