Skip to content

Instantly share code, notes, and snippets.

@kotoripiyopiyo
Created December 11, 2020 11:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kotoripiyopiyo/8445546fb0df3bb5e5cd15455c8e29a2 to your computer and use it in GitHub Desktop.
tsファイルをつなぎ合わせてひとつのmp4にする
#! python3
#tsファイルをつなぎ合わせてひとつのmp4にする
import os
import subprocess
tmp_list = [i for i in os.listdir() if i.endswith('.ts')]
tmp_list.sort()
with open('./ts_list.txt', 'w') as ts_list:
for l in tmp_list:
ts_list.write(f'file {l}\n')
subprocess.run('/usr/local/bin/ffmpeg -f concat -safe 0 -i ts_list.txt -c copy output.mp4', shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment