ffmpeg: converting an avi to a reduced, shareable flv/mp4...
- by meder
I recently followed a guide and recompiled my ffmpeg so x264 is enabled. I used some generic settings to convert my 700 MB avi file to a mp4 file, the result was a 407MB mp4 file.
The original avi file's settings:
Codec: DX50
Resolution: 704x304
Frame rate: 23.976023
Stream 1
Codec: mpga
Type: Audio
Channels: 2
Sample rate: 48000 Hz
Bitrate 179 kb/s
Command I used:
ffmpeg -i input.avi -acodec libfaac
-ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 output.mp4
The settings of the output file (output.mp4):
Codec: avc1
Resolution: 704x304
Display resolution: 704x304
Frame rate: 11.988011
Stream 1
Codec: mp4a
Type: Audio
Channels: 2
Sample Rate: 48000 Hz
Bits per sample: 16
Bitrate: 1536 kb/s
The quality of the output mp4 is pretty nice, it seems as if it's pretty much the same as the original source. However, I'm trying to reduce the filesize and I'm not really sure whether I should go with an flv format or keep it mp4. The advantage the flv would have obviously is that it would be playable with a flash player ( I have come across some swf players which take a flash parameter to play an flv file ).. but maybe I could use the video element, as I'm only going to be displaying this video privately so I don't have to worry about supporting legacy browsers such as IE.
Can someone recommend some settings to specify in order for the filesize to be around ~100-150MB or so? I don't mind a reduction in quality, nor do I mind resizing it - I was going to do it initially but I wasn't sure what the guidelines were ( if any ) for dealing with resolution.. since this video's is 704x304 would it still be ok if I forced it into one that isn't perfectly fit for the aspect ratio? I have no clue about that part. I realize that I could have probably specified 28 instead of 22 for the CRF, I'm not sure if I should do that as opposed to maybe specifying smaller resolution, which might make it smaller as well?