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

Bo Berglund bo.berglund at gmail.com
Fri Jul 9 09:14:28 EEST 2021


On Thu, 08 Jul 2021 15:22:24 -0500, Leo Butler via ffmpeg-user
<ffmpeg-user at ffmpeg.org> wrote:

>> Yet it did not output a finding of "frozen" or similar.
>
>It did. See the line I highlighted above. All you need to do now is
>something like filter the output of ffmpeg like:
>
>ffmpeg -i bluearrow.mp4 -vf "freezedetect=n=0.01:d=5" -map 0:v:0 -f null - | grep -q 'lavfi.freezedetect.freeze_start: '
>nofreeze=$?

I tested the command using two different video snippets as input (with and
without the blue arrow) and the screen output shows the line:

[freezedetect @ 0x555be8939800] lavfi.freezedetect.freeze_start: 0
for *only* the bluearrow.mp4 video so this is a step forward!

However, the grep command does the same (nothing) in both cases!

I tested by replacing the | grep ... stuff with a redirect to file instead
ffmpeg -hide_banner -i bluearrow.mp4 -vf "freezedetect=n=0.01:d=5" -map 0:v:0 -f
null -  > freezeoutput.txt

This showed the same screen output but the freezeoutput.txt file is created but
is empty!
So grep has no chance of ever detecting anything....

Strange that the ffmpeg execution puts a lot of stuff on screen but nothing
comes out in an output redirect file!!

How can I programmatically check what is shown on screen when it does not reach
the output?

Is this what you mean by:
>
>O! ffmpeg sends stuff to stdout and stderr in random ways, so you will
>need to redirect stderr to stdout, I suspect.

Note that I am testing this in an ssh command line session to the linux box
using PuTTY.


-- 
Bo Berglund
Developer in Sweden



More information about the ffmpeg-user mailing list