Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone suggest a command to encode video to h264 baseline profile (level 1)?

Here is a link for reference:

I used this command but FFmpeg says it is Main profile, not Baseline.

ffmpeg -i <SOURCE> -vcodec libx264 -coder 0 -flags +loop+mv4 \
-partitions +parti4x4+parti8x8+parti4x4+partp8x8+partb8x8 -me_method hex -subq 7 \
-trellis 1 -refs 5 -bf 0 -flags2 +mixed_refs -coder 0 -me_range 16 -threads 2 \
-s 240x160 -b:v 64k -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 \
-qmin 10 -qmax 51 -qdiff 4 -strict experimental -acodec aac -ac 1 -ab 48000 \
-f mpegts udp://
share|improve this question
up vote 5 down vote accepted

Make sure you've got the latest FFmpeg and libx264 – this is really important * – and then try something like:

ffmpeg -i … -c:v libx264 -profile:v baseline -level 1 …

This will result in:

[libx264 @ 0x10180fa00] profile Constrained Baseline, level 1.0

Of course, you can supply the -preset and -tune options to x264 as well. Refer to x264 --fullhelp for more info.

Here are the x264 options used:

cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=0 weightp=0 keyint=250 
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 
rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 
qpstep=4 ip_ratio=1.40 aq=1:1.00

* It works with FFmpeg 0.9 and x264 core 118. The -vprofile option was undocumented in FFmpeg, now it's -profile:v. It now basically works just like -profile, which again is supposed to replace -vpre. It uses x264's built-in profiles instead of relying on .ffpreset files.

share|improve this answer
thank you. Does the output work on android phones? – Morteza M. Dec 25 '11 at 15:38
It plays on my Android phone, yes. – slhck Dec 25 '11 at 16:39
failed to play in Android 2.1 Eclair emulator – leon Jan 7 '13 at 8:57
@leon I've been using this command all the time and it worked for every Android device I've used. Maybe it's a problem with the emulator. – slhck Jan 7 '13 at 15:44
@slhck it works in Android 2.2, only failed in 2.1. Same format file generated using iMovie, works fine in 2.1. I only got chance to test in emulator, not in real devices. – leon Jan 11 '13 at 7:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .