Skip to content

Instantly share code, notes, and snippets.

@cuibonobo
Created May 29, 2021 18:32
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 cuibonobo/0f0cdd270422326e8bac83826434e505 to your computer and use it in GitHub Desktop.
Save cuibonobo/0f0cdd270422326e8bac83826434e505 to your computer and use it in GitHub Desktop.
Small script to figure out the ffmpeg command that Kitsu uses to generate videos: https://github.com/cgwire/zou/blob/9ed714b47e71b56c2fafab46dbc5cb68d0fc8516/zou/utils/movie.py#L92-L108
import ffmpeg
# Project settings
width = 1920
height = 1080
fps = 24
# Input movie settings
movie_path = "/tmp/zou/33d9712d-d093-478f-89e6-537bea667535.mp4.tmp"
w = 960
h = 540
# Output
file_target_path = "/tmp/zou/myoutput.mp4"
stream = ffmpeg.input(movie_path)
stream = ffmpeg.output(
stream.video,
stream.audio,
file_target_path,
pix_fmt="yuv420p",
format="mp4",
r=fps,
video_bitrate="28M",
preset="slow",
vcodec="libx264",
color_primaries=1,
color_trc=1,
colorspace=1,
movflags="+faststart",
s="%sx%s" % (width, height),
)
print(' '.join(ffmpeg.compile(stream)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment