--- lang: ja-jp breaks: true --- # ffmpeg python で 動画の切り出し 2021-07-06 ```python= # %% from IPython.core.display import DisplayHandle from IPython.display import Math, display import os import subprocess ffmpeg = r"D:\bin\ffmpeg.exe" # 編集したい動画のパス file_path = r"C:\temp\Ch1_20210706133331.mp4" save_path = r"C:\temp\test.mp4" start_min = 8 start_sec = 25 end_min = 9 end_sec = 54 start = ((0 * 60 * 60) + (start_min * 60) + start_sec) # 切り出し開始時刻。秒で表現 end = ((0 * 60 * 60) + (end_min * 60) + end_sec ) # 切り出し終了時刻。同じく秒で表現 cmd = ffmpeg + ' -ss ' + str(start) + ' -i ' + file_path + ' -t ' + \ str(end - start) + \ ' -vcodec copy -acodec copy ' + save_path + ' -y' subprocess.check_call(cmd.split()) ``` :::info ちなみに、`moviepy` は遅すぎて使い物にならなかった。 ::: ###### tags: `ffmpeg` `Python` `moviepy` `動画の切り出し`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up