-
Recommended FFmpeg command for converting videos to iPhone/Android
Hi!
I’m setting up a CentOS Server with FFmpeg to convert source FLV (and soon MP4/H264) videos to MP4/H264/AAC compatible mainly with iPhone and Android devices (and new devices that support H264/AAC) to be streamed using Wowza Streaming Server over 3G mobile networks.
Currently we do our video conversion on a Windows Machine with FFmpeg and the following command:
ffmpeg.exe -i source_video.flv -y -vcodec libx264 -s qvga -acodec libfaac -ab 96k -ac 2 -b 200K -threads 4 -flags +loop -cmp +chroma -partitions 0 -me_method epzs -subq 1 -trellis 0 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 target_video.mp4That command was done by a co-worker a couple years ago and its working fine on the tests I’ve done.
However since I’m installing this new server with the latest version of FFmpeg, I wanted to know if I could optimize that command for better results in this Linux server with the latest FFmpeg.
I tried the above command on my new server and produced similar results as I used to produce in the Windows machine setup.
Here is the meta data from a sample video I produced using the above command on my new Linux setup.
General
Complete name : ffmpeg_test.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 5.08 MiB
Duration : 2mn 39s
Overall bit rate : 268 Kbps
Writing application : Lavf52.64.2Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3.0
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 2mn 39s
Bit rate mode : Variable
Bit rate : 200 Kbps
Width : 320 pixels
Height : 240 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 30.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.087
Stream size : 3.96 MiB (78%)
Writing library : x264 core 107
Encoding settings : cabac=0 / ref=1 / deblock=1:0:0 / analyse=0x1:0 / me=dia / subme=1 / psy=1 / psy_rd=0.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=300 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=200 / ratetol=20.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / vbv_maxrate=10000 / vbv_bufsize=10000 / ip_ratio=1.41 / aq=1:1.00 / nal_hrd=noneAudio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 2mn 39s
Bit rate mode : Variable
Bit rate : 55.8 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 22.05 KHz
Compression mode : Lossy
Stream size : 1.06 MiB (21%)
What do you think?
Could that command be optimized for better results?
Thanks!