6

I use FFMPEG since few moments now and after asking for help here a first time about that, i was able to discover this command line that i use since then, for the conversion of .MP4 video to .FLV : ffmpeg -i namefile.mp4 -c:v libx264 -crf 19 destinationfile.flv .

The results was simply amazing ! Perfect video and a lot less space needed. But i've try this same line for a new video and didn't work.

This is what appears to me :

[libmp3lame @ 03eaf5a0] flv does not support that sample rate, choose from (44100, 22050, 11025).

After that, i've try theses commands lines

ffmpeg -i in.mp4 -c:v libx264 -b:v 500k -c:a copy out.flv 
ffmpeg -i in.mp4 -c:v libx264 -ar 22050 -crf 19 out.flv

Without succes. So right now i just dont know what to do else to be able to convert this MP4 file to a FLV one, who is smaller in size and keep a perfect image, just like the others conversions made with the first code line before.

Thanks for your help !

John_D
  • 833
  • 1
  • 8
  • 13
  • 1
    Please show the complete, uncut console output of `ffmpeg -i in.mp4 -c:v libx264 -ar 22050 -crf 19 out.flv`. – llogan May 29 '12 at 17:29
  • What's `-crf 19` do? I don't see it in the [current FFmpeg docs](http://ffmpeg.org/ffmpeg.html). – blahdiblah May 29 '12 at 17:45
  • Hi @LordNeckbeard and thanks for your help ! I cut a printscreen of the informations at the end of the conversion by FFMPEG, i hope this is what you asked for and if not, i'm sorry and just tell me where i can find exactly the console output. [Image here](http://imageshack.us/f/716/ffmpeg1.jpg/) The file size once converted was 163mo and the original one 187. It's good, but the many times i do something like that with FFMPEG, the result was more 89/90mo for a 187mo original file size. Si i think i'm maybe wrong about the line code i use for this conversion. Thanks ! – John_D May 29 '12 at 17:58
  • For @blahdiblah , i found it at this link : [link](http://blog.superuser.com/2012/02/24/ffmpeg-the-ultimate-video-and-audio-manipulation-tool/) At the Advanced options, Quality settings. – John_D May 29 '12 at 17:59
  • @John_D Not quite what I was looking for. I'd like to see the complete, full, uncut output that ffmpeg gives you after it is done encoding. Also, can you explain "without success"? What exactly is wrong with the command with `-ar`? – llogan May 29 '12 at 21:59
  • @LordNeckbeard Well the whitout success is because the major codeline i use normally didn't work and the size of the video is too big for my needs. For example, after using `ffmpeg -i in.mp4 -c:v libx264 -ar 22050 -crf 19 out.flv` the video was more then 80mo bigger vs the original. But my first goal with FFMPEG is to have smaller videos. I pick this time the beginning and the end of FFMPEG, i hope it's good ! [start](http://imageshack.us/f/546/debutq.jpg/) [end](http://imageshack.us/f/696/finbu.jpg/) (Also, why -3 ? What could i do to avoid that in future ?) Thanks again for your time! – John_D May 30 '12 at 15:09

1 Answers1

5

You are having several issues and you already solved flv does not support that sample rate by including -ar. It took me several comments for clarification, but your other issue, if I understand you correctly, is that the output is still too big in file size.

You mentioned FFmpeg: The ultimate Video and Audio Manipulation Tool which explains:

The CRF can be anything within 0 and 51, with the reasonable range being 17 to 23. The lower, the better the quality, the higher the file size. In general, the best bet is to just try and see for yourself what looks good. Take into account the result file size you want and how much quality you can trade in for smaller file sizes. It’s all up to you.

What that means is that you need to choose the highest CRF value that still gives you the quality you want. So instead of 19, which is very high quality, try a higher value. That doesn't mean you have to encode the whole video to get a general idea of what a particular crf value will look like. Use the -ss and -t options to select random sections to encode. This example will skip the first 2 minutes and 30 seconds and encode a 10 second clip:

ffmpeg -ss 00:02:30 -i input -t 30 -c:v libx264 -preset medium -crf 24 output.mp4

As shown in the example -ss and -t can accept either hours:minutes:seconds or just seconds.

Choosing to use crf means that you want your outputs to have a certain quality and file size is less of a concern. If the opposite is true, that you want your output to be a certain file size and quality is less of a concern then you need to use two-pass bitrate mode instead of crf. You can't easily know what the file size will be with crf, but a two-pass encode with -b:v can approximately let you choose the file size in advance. In this example the desired output is 100 MB and the input is 671 seconds in duration (see the link for the math) so the command will be:

ffmpeg -i input -c:v libx264 -preset medium -b:v 1092k -pass 1 -an -f mp4 -y NUL
ffmpeg -i input -c:v libx264 -preset medium -b:v 1092k -pass 2 -c:a libfaac -b:a 128k output.mp4

Personally, I rarely use a two-pass encode because I prefer my set of videos to be a similar quality (and therefore varying file sizes which I care less about).

As for the -3 (the current stackoverflow question rating), I assume readers thought your question was unclear since you did not explain "without success" so nobody knew what the actual problem was. Be direct, descriptive, and provide all useful information: especially the commands and console outputs with your next FFmpeg question and you will get better and faster answers.

Community
  • 1
  • 1
llogan
  • 121,796
  • 28
  • 232
  • 243
  • Thanks @LordNeckbeard ! Once again you help me in that subject (FFMPEG) ! I'm sorry if i was not totally clear, i'm a beginner in that, try my best and, as you have surely notice, my english isn't perfect because i don't use it very often. I'm evermore thankful to your help, considering theses factors, who don't attract many people. I'll save your message, to keep it's informations and tips, like i've done the last time. Thank you VERY much ! It's very appreciate ! Have a nice day and thanks once again for your help ! – John_D May 30 '12 at 20:00