Skip to content

Instantly share code, notes, and snippets.

@0asa
Last active April 26, 2019 13:30
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 0asa/5d2e3c30353e11497ba3ac5ae90c527c to your computer and use it in GitHub Desktop.
Save 0asa/5d2e3c30353e11497ba3ac5ae90c527c to your computer and use it in GitHub Desktop.
Interleave fields and deinterlace
# https://ffmpeg.org/ffmpeg-filters.html#il
import ffmpeg
try:
top = ffmpeg.input("top/%d.jpg")
bot = ffmpeg.input("bottom/%d.jpg")
s = (
ffmpeg
.filter([top, bot], 'vstack')
.filter('il', l='i', c='i')
.filter('yadif', mode=1, parity=0)
.output('out.mp4')
.global_args('-y')
)
s.run(capture_stdout=False, capture_stderr=True)
except ffmpeg.Error as e:
print(e)
# https://ffmpeg.org/ffmpeg-filters.html#tinterlace
try:
s = (
ffmpeg
.input("%04d.jpg")
.filter('tinterlace', mode=0)
.filter('setsar', sar='1/1')
.filter('yadif', mode=1, parity=0)
.output('out.mp4')
.global_args('-y')
)
s.run(capture_stdout=False, capture_stderr=True)
except ffmpeg.Error as e:
print(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment