Skip to content

Instantly share code, notes, and snippets.

@avoidik
Last active January 25, 2021 09:09
Show Gist options
  • Save avoidik/153879c06afdcaad8d69b38bcc00abb7 to your computer and use it in GitHub Desktop.
Save avoidik/153879c06afdcaad8d69b38bcc00abb7 to your computer and use it in GitHub Desktop.
ffmpeg encode mpeg2 ps and ts profiles
# with PCM 16-bit audio (uncompressed), constant video bitrate with specific bitrate tolerance
ffmpeg -i "input.mp4" \
  -c:v mpeg2video -pix_fmt yuv422p -refs 1 -bf 2 -b:v 50M -maxrate 50M -minrate 50M \
  -s 1920x1080 -aspect 16:9 \
  -c:a pcm_s16be -f vob \
  "output.mpg"
# with AC3 audio (Dolby Digital)
ffmpeg -i "input.mp4" \
  -c:v mpeg2video -b:v 20M -refs 1 -bf 0 -c:a ac3 -b:a 384k -async 1 -f vob \
  "output.mpg" 
# with MP3 audio (MPEG-1 Audio Layer 3)
ffmpeg -i "input.mp4" \
  -c:v mpeg2video -b:v 20M -c:a mp3 -b:a 192k -f vob \
  "output.mpg" 

ref. https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/MPEG

ref. https://trac.ffmpeg.org/wiki/Encode/MPEG-4

ref. https://trac.ffmpeg.org/wiki/Encode/H.264

ref. https://en.wikipedia.org/wiki/MPEG_program_stream

ref. https://en.wikipedia.org/wiki/MPEG_transport_stream

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