I'm trying to write script that will be downloading part of youtube video by url. I'm using ffmpeg
+ ffmpeg-python
library.
I have terminal command that I want put to python code.
ffmpeg -i "url_to_download" -ss 00:00:15 -t 00:00:25 -c:v copy -c:a copy "demo.mp4"
url_to_download
is an youtube stream url that I get like in an answer to another question https://stackoverflow.com/a/57134397/6583203
I started writing script
import ffmpeg
FROM = "00:00:15"
TO = "00:00:25"
TARGET = "demo.mp4"
ffmpeg.input(url_to_download, ss=FROM, t=TO)
But I don't know how to pass parameters -c:v copy -c:a copy "demo.mp4"
to ffmpeg.input
Do not advice me to use subprocess
. I have the same error like in a following question: Python ffmpeg won't accept path, why?
This answer worked for me
ffmpeg.input(url_to_download, ss=FROM, t=TO).output("demo.mp4", vcodec="copy", acodec="copy").overwrite_output().run()