Skip to content

Instantly share code, notes, and snippets.

@nngogol
Created February 8, 2019 14:27
Show Gist options
  • Save nngogol/d44b1561ffc3a53c6436f3b0b25c236a to your computer and use it in GitHub Desktop.
Save nngogol/d44b1561ffc3a53c6436f3b0b25c236a to your computer and use it in GitHub Desktop.
get_video
import os
import ffmpeg
import click
@click.command()
@click.argument('fname', type=click.Path(exists=True))
def cli(fname):
'''
Вытягивает видео дорожку из файла.
Использование:
1.
py get_v.py 1.webm
->>> 1_v_only.webm
2.
py get_v.py 1.mp4
->>> 1_v_only.mp4
'''
output_file = '{:1}_v_only{:2}'.format(*os.path.splitext(fname))
ffmpeg.output(ffmpeg.input(fname)['v'], output_file, vcodec='copy').run()
if __name__ == '__main__':
cli()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment