Skip to content

Instantly share code, notes, and snippets.

@yordanoweb
Last active August 22, 2022 03:07
Show Gist options
  • Save yordanoweb/4ae5d308daa2449418f601ac6cc639b5 to your computer and use it in GitHub Desktop.
Save yordanoweb/4ae5d308daa2449418f601ac6cc639b5 to your computer and use it in GitHub Desktop.
Encode videos with mencoder and subtitles format (font size, color and more...)

Pass to mencoder the right parameters

  • Note the -ass-force-style and the -ass parameters...
  • Also, note the extension of the subtitles file is a .srt file
  • The rest of the options are for video encoder, video format, size, bitrate, etc... In this example we encode to AVI XVID with MP3 audio.
nice -n 10 /usr/bin/mencoder "/home/john/Videos/Red.mp4" -o "/home/john/Videos/Red.avi" \
   -ass-force-style "FontSize=32,PrimaryColour=&H00ffff,Bold=1,MarginV=24" \
   -ass /home/john/Videos/Red.srt -ofps 24 -vf softskip,scale=700:300:0,harddup \
   -sws 10 -oac mp3lame -lameopts abr:br=128:aq=4:vol=10:mode=1 \
   -ovc xvid -xvidencopts bitrate=3000:threads=4:me_quality=6:vhq=3:\
             max_bframes=2:bvhq=1:trellis:chroma_me:\
             chroma_opt:hq_ac:nolumi_mask:closed_gop:noqpel:nogmc:nopacked:\
             rc_reaction_delay_factor=0:rc_averaging_period=100:autoaspect:nointerlacing

Feel free to try an explore all the subtitle options offered by the ASS format.

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