[FFmpeg-user] How to check if a youtube URL is valid before starting download?
Bo Berglund
bo.berglund at gmail.com
Wed Jul 7 18:48:43 EEST 2021
On Wed, 7 Jul 2021 13:54:11 +0100, Rob Hallam <ffmpeg at roberthallam.com> wrote:
>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
Like the examples I have seen before all examples suppose that you have the
video available as a file, whereas I am checking a *live stream* on YouTube
which freezes from time to time and just shows a still (often just a blue
triangle on black background).
I have an automatic download scheme running on Linux to get the 1-hour segment
videos from the stream so I can view them later, but I want to have a check for
the times the stream stops so I can do something about it (like switching
stream).
So my "takedown detect" script checks if the stream is being blocked by Youtube
and this works using youtube-dl with the -F switch. Works OK, I get an email if
it is blocked.
But now I saw a different error I also want to check for, this is when the
stream semingly works fine but the video has frozen.
Then my earlier detection does not catch it so I have to add a new detect to see
the frozen video case too....
So ffmpeg must accept the -i argument as an on-line stream somehow...
Unless there is some other way to detect that a stream sends a still image.
--
Bo Berglund
Developer in Sweden
More information about the ffmpeg-user
mailing list