Skip to content

Instantly share code, notes, and snippets.

@Delnegend
Created November 20, 2023 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Delnegend/fc84566c3f4af6e4a941d40633871489 to your computer and use it in GitHub Desktop.
Save Delnegend/fc84566c3f4af6e4a941d40633871489 to your computer and use it in GitHub Desktop.
Transcode any video into Nokia 150 compatible file so it can playback
import sys, subprocess, os
def main():
input_file = sys.argv[1]
output_file = os.path.splitext(input_file)[0] + '.nokia150.avi'
subprocess.call(f"ffmpeg -i \"{input_file}\" -vf \"scale='min(320,iw)':min'(240,ih)':force_original_aspect_ratio=decrease\" -vcodec mjpeg -q:v 3 -acodec pcm_s16le -ar 8000 -ac 1 \"{output_file}\"", shell=True)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment