Log in

View Full Version : x264 setting for stutterfree playback on old Macbook Air


Mr Alpha
9th April 2011, 14:06
So I have a short 2 min clip that is 720p at 59.94 fps. I'm frameserving it from Premiere Pro and encoding with x264.

First I tried simply:
x264 --crf 18 --fps 59.94 --input-res 1280x720 --preset veryslow --level 4.1 -o elisa.mp4 elisa.avs
but it stuttered like hell. Then I tried:
x264 --crf 18 --fps 59.94 --input-res 1280x720 --preset veryslow --ref 4 --level 4.1 -o elisa.mp4 elisa.avs
Still stuttering. So I figured lets cut to the chase and went down to:
x264 --crf 18 --fps 59.94 --input-res 1280x720 --preset veryslow --profile main --level 3.1 -o elisa.mp4 elisa.avs
Still stuttering. Getting desperate I tried:
x264 --crf 18 --fps 59.94 --input-res 1280x720 --preset veryslow --profile main --level 3.1 --no-cabac -o elisa.mp4 elisa.avs
Still stuttering. Are there any settings that allows stutter free playback of 59.94fps content on a 2GHz Macbook Air?

All of these encodes play perfectly on both this workstation and a cheap 500€ windows laptop.

nurbs
9th April 2011, 14:50
Try "--tune fastdecode" or some some of the options that this tuning uses.

wipple
9th April 2011, 14:57
1. Encode with '--tune fastdecode'
2. Play with ffmpeg-mt via MPlayer OSX Extended

Mr Alpha
10th April 2011, 14:08
Using Main@3.1 with --tune fastdecode and playing on Mplayer OSX Extended using ffmpeg-mt it still stutters. With Mplayer it is even worse than quicktime.

EDIT: Using mainconcept with Main@4.1 works perfectly fine. And with the c264 encodes, even though the playback stutters, the CPU usage is nowhere near 100%. Is there some weird feature or function that x264 has that break Mac compatibility I need to turn off?

LoRd_MuldeR
10th April 2011, 19:44
Maybe your H.264 decoder only supports multi-threaded decoding for H.264 streams with slices and Mainconcept uses slices? (x264 does not, by default).

This at least would explain why the Mainconcept-encoded file gives better performance than the x264-encoded file with your playback solution...

nurbs
10th April 2011, 19:45
Personally I haven't heard anyone on this forum complain about playback of x264 encoded files on MacOS, except when Quicktime was involved. Handbrake, which is popular with Mac users, comes with several presets for Apple devices, but none of them use any special settings, they are basically straight HP@3.1 or 4.1 (if you don't need compatibility with the iDevices).

What software do you use to encode and what x264 revision is used? Maybe you got a problem with the build you use, or maybe with the Mplayer version.

shon3i
10th April 2011, 19:46
Mainconcept uses slices? Depends from preset, but aslo probably use VBV model so strict high peaks, and probably that's why his has no suttering.

EDIT: Mr Alpha, try to add to your x264 commandline and this options for example :

x264 --crf 18 --fps 59.94 --input-res 1280x720 --preset veryslow --level 4.1 --ref 4 --slices 4 --vbv-bufsize 30000 --vbv-maxrate 30000 --nal-hrd vbr --aud -o elisa.mp4 elisa.avs

Mr Alpha
10th April 2011, 23:02
Depends from preset, but aslo probably use VBV model so strict high peaks, and probably that's why his has no suttering.

EDIT: Mr Alpha, try to add to your x264 commandline and this options for example :

x264 --crf 18 --fps 59.94 --input-res 1280x720 --preset veryslow --level 4.1 --ref 4 --slices 4 --vbv-bufsize 30000 --vbv-maxrate 30000 --nal-hrd vbr --aud -o elisa.mp4 elisa.avsThe exact same result. :S

In an effort to eliminate variables I tried muxing with mkvtoolnix instead of yamb but it still resulted in the same issues.

shon3i
10th April 2011, 23:27
Only explanation that Mainconcept encode use much less bitrate. Can you tell us what Mainconcept bitrate vs x264's crf18?

mp3dom
10th April 2011, 23:47
Probably it doesn't change anything, but isn't forcing 59.94 a bad idea? I mean... it should be 60000/1001 which is not 59.94.

Mr Alpha
11th April 2011, 09:21
Only explanation that Mainconcept encode use much less bitrate. Can you tell us what Mainconcept bitrate vs x264's crf18?This is the mediainfo for the one done with your suggested commandline:
General
Complete name : C:\Users\Public\Videos\elisa15.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 52.2 MiB
Duration : 1mn 51s
Overall bit rate : 3 929 Kbps
Encoded date : UTC 2011-04-09 20:55:02
Tagged date : UTC 2011-04-09 20:55:02
Writing application : Yamb 2.1.0.0 [http://yamb.unite-video.com]

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 51s
Bit rate mode : Variable
Bit rate : 3 798 Kbps
Maximum bit rate : 30.0 Mbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 59.940 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.069
Stream size : 50.4 MiB (97%)
Writing library : x264 core 114 r1924 08d04a4
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / slices=4 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=30000 / vbv_bufsize=30000 / crf_max=0.0 / nal_hrd=vbr / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2011-04-10 20:42:21
Tagged date : UTC 2011-04-09 20:55:03

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 67
Duration : 1mn 51s
Bit rate mode : Variable
Bit rate : 125 Kbps
Maximum bit rate : 129 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 1.67 MiB (3%)
Encoded date : UTC 2011-04-09 20:55:03
Tagged date : UTC 2011-04-09 20:55:03and this is what MainConcept produces:
General
Complete name : C:\Users\Public\Videos\elisa13.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 57.5 MiB
Duration : 1mn 51s
Overall bit rate : 4 329 Kbps
Encoded date : UTC 2011-04-10 16:35:59
Tagged date : UTC 2011-04-10 16:35:59
©TIM : 00;00;00;00
©TSC : 60000
©TSZ : 1001

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Format settings, GOP : M=4, N=33
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 51s
Bit rate mode : Variable
Bit rate : 4 133 Kbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 59.940 fps
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.075
Stream size : 54.9 MiB (95%)
Language : English
Encoded date : UTC 2011-04-10 16:35:59
Tagged date : UTC 2011-04-10 16:35:59

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 1mn 51s
Bit rate mode : Variable
Bit rate : 192 Kbps
Maximum bit rate : 287 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 2.52 MiB (4%)
Language : English
Encoded date : UTC 2011-04-10 16:35:59
Tagged date : UTC 2011-04-10 16:35:59