Skip to content

Instantly share code, notes, and snippets.

@benwilber
Created August 20, 2015 03:00
Show Gist options
  • Save benwilber/f8c82ced90d2ba0490c7 to your computer and use it in GitHub Desktop.
Save benwilber/f8c82ced90d2ba0490c7 to your computer and use it in GitHub Desktop.
import av
from av import AV
video_codec_opts = {"moov": "start"} # put the moov header at the front of the file
audio_codec_opts = {'codec': 'libfdk_aac'} # default libfaac
with open("source.mov") as fd:
vid = AV(fd)
vid.resize(720, 480)
vid.transcode_video(av.H264, **video_codec_opts)
vid.transcode_audio(av.AAC, **audio_codec_opts)
vid.save("output.mp4") # or a file-like
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment