[FFmpeg-user] How to check if a youtube URL is valid before starting download?

Rob Hallam ffmpeg at roberthallam.com
Wed Jul 7 15:54:11 EEST 2021


On Wed, 7 Jul 2021 at 13:43, Bo Berglund <bo.berglund at gmail.com> wrote:
> On Wed, 07 Jul 2021 14:21:15 +0200, Bo Berglund <bo.berglund at gmail.com> wrote:
> >So is there a way to check if a video is static and generate an error in that case?
> >Something like:
> >ffmpeg -i input_url -checkstaticvideo <maxstatictime>
> >
> >Is this possible?

If you cannot get freezedetect to work, a workaround could be to
extract two images from a video stream separated in time, and use
imagemagick's 'compare' to get a numerical difference between them.
The documentation on that should be sufficient for you to wrangle up a
script to your liking.

https://imagemagick.org/script/compare.php
https://legacy.imagemagick.org/Usage/compare/

In the meantime, there is an example on this SuperUser answer from 2019:

https://superuser.com/a/1429300/461558

Cheers,
Rob


More information about the ffmpeg-user mailing list