Using `-to` instead of `-t` when using YouTube link as input
This answer shows how to get a portion of a YouTube video by using URLs as input. The command works mostly fine, but I want to avoid using -t
as I need to cut between specific timestamps and I'd rather not have to calculate the difference between timestamps beforehand.
However, when I try to adapt the command to use -to
instead:
# get URLs
youtube-dl --get-url --youtube-skip-dash-manifest "https://www.youtube.com/watch?v=MfnzBYV5fxs"
# crop 1 min from 6 mins onwards
ffmpeg -ss 00:06:00.00 -i "$video_url" -ss 00:06:00.00 -i "$audio_url" -to 00:07:00.00 -c:v libx264 -preset ultrafast test.mkv
...it ignores the second timestamp and downloads until the end. Why is this, and can it be fixed?
Both ffmpeg
and youtube-dl
versions are relatively recent and I've used the -to
option without issue before.
Solution 1:
Apply -to
on the inputs when using -ss
for inputs.
ffmpeg -ss 00:06:00.00 -to 00:07:00.00 -i "$video_url" -ss 00:06:00.00 -to 00:07:00.00 -i "$audio_url" -c:v libx264 -preset ultrafast test.mkv