Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smohammadhn/6b33aa4664c1b6253337e2656156039f to your computer and use it in GitHub Desktop.
Save smohammadhn/6b33aa4664c1b6253337e2656156039f to your computer and use it in GitHub Desktop.
ffmpeg command to convert any video to a format which is widely known by older devices (Tvs, etc ...)
ffmpeg -i input.mp4 -vf "fps=24" -c:v libx264 -crf 23 -maxrate 2M -bufsize 2M -c:a aac -b:a 192k output.mp4
@smohammadhn
Copy link
Author

  • -i input.mp4: Specifies the input video file.
  • -vf "fps=24": Sets the output frame rate to 24 frames per second.
  • -c:v libx264: Specifies the video codec as H.264, which is widely supported by TVs.
  • -crf 23: Sets the Constant Rate Factor (CRF) for video quality. Lower values result in higher quality but larger file sizes. A value of around 23 provides a good balance between quality and file size.
  • -maxrate 2M -bufsize 2M: Sets the maximum bitrate and buffer size to 2 Mbps, ensuring compatibility with weaker devices.
  • -c:a aac -b:a 192k: Specifies the audio codec as AAC with a bitrate of 192 kbps.
  • output.mp4: Specifies the output file name.

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