Skip to content

Instantly share code, notes, and snippets.

@brookemckim
Created June 8, 2011 19:05
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save brookemckim/1015107 to your computer and use it in GitHub Desktop.
Save brookemckim/1015107 to your computer and use it in GitHub Desktop.
Roku Recommended FFMPEG h264 Preset
ffmpeg -i <inputFile> -f mpegts -acodec libfaac -vcodec libx264 \ -vpre roku -crf 15 -threads 0 ~/OneTransportStreamFile3200.ts
coder=1
flags=+loop
cmp=+chroma
partitions=+parti8x8+parti4x4+partp8x8+partb8x8
me_method=umh
subq=8
me_range=16
g=250
keyint_min=25
sc_threshold=40
i_qfactor=0.71
b_strategy=2
qcomp=0.6
qmin=10
qmax=51
qdiff=4
bf=4
refs=4
directpred=3
trellis=1
flags2=+wpred+mixed_refs+dct8x8+fastpskip
ffmpeg -i <InputFile> -acodec libfaac –ab 128 -vcodec libx264 \ -vpre roku -crf 15 -threads 0 ~/outputFile.mp4
@westurner
Copy link

I had to change directpred= to direct-pred= for use with ffpmeg 3.3.6:

coder=1 
flags=+loop
cmp=+chroma 
partitions=+parti8x8+parti4x4+partp8x8+partb8x8 
me_method=umh
subq=8 
me_range=16 
g=250 
keyint_min=25 
sc_threshold=40 
i_qfactor=0.71 
b_strategy=2 
qcomp=0.6 
qmin=10
qmax=51 
qdiff=4 
bf=4 
refs=4 
direct-pred=3 
trellis=1 
#flags2=+wpred+mixed_refs+dct8x8+fastpskip

There's probably a variation on flags2= which works now? Instead, I just commented the flags2 param and the videos seemed to work on a fairly recent Roku.

And also, with Linux, I had to change the mp4 switch from -acodec libflaac to -acodec aac:

ffmpeg -y -i "${input}" -acodec aac -ab 128k -vcodec libx264 -vpre roku -crf 15 -threads 0 "${output}"

@westurner
Copy link

Also, I had to read manpages to determine that this is necessary for ffpmeg to find the preset:

mkdir -p ~/.ffmpeg
cp libx264-roku.ffpreset ~/.ffpmeg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment