Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques Recommended FFmpeg command for converting videos to iPhone/Android

  • Recommended FFmpeg command for converting videos to iPhone/Android

    Posted by Guillermo Carrion on April 1, 2011 at 11:55 am

    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.mp4

    That 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.2

    Video
    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=none

    Audio
    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!

    Michael Rampe replied 15 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Michael Rampe

    April 1, 2011 at 10:23 pm

    [Guillermo Carrion] “Could that command be optimized for better results?”

    Most definitely. Which version of FFmpeg and Wowza are you using for this project? seems quite old due to lack of a -vpre for x264. Funnily enough, I am also currently doing work on getting wowza to stream to iphones and other mobile devices.

    Anyway, I think you could achieve much better quality using a main profile, higher bitrate and larger size.

    Michael

  • Guillermo Carrion

    April 1, 2011 at 11:01 pm

    Hi!

    The FFmpeg version I’m running on my new Linux CentOS Server is: FFmpeg version 0.6.1

    About Wowza, I believe is version: 2.2 (is provided by NetDNA/HDDN)

    However, the command in my previous post, was done maybe over two years ago by a co-worker. That’s because I want to know if there is any other new commands to achieve better optimized results.

    thanks

  • Guillermo Carrion

    April 1, 2011 at 11:05 pm

    Michael Rampe: “Anyway, I think you could achieve much better quality using a main profile, higher bitrate and larger size.”

    Do you have a sample command to achieve this?
    About the larger size, I would prefer not going too much large, because is for mobile streaming over 3G, and I want to take in consideration slow 3G when low reception and all that. 😉

  • Michael Rampe

    April 2, 2011 at 12:34 am

    you will find the x264 presets in the ffpresets folder. Try some different ones and then limit to main profile as a second vpre option.

    eg “-vpre fast -vpre main”

    Michael

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy