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

Christian Ebert bcc at phloxic.productions
Fri Jul 9 12:10:11 EEST 2021


* Bo Berglund on Friday, July 09, 2021 at 08:14:28 +0200:
> <ffmpeg-user at ffmpeg.org> wrote:
>> 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!

ffmpeg writes the log output to stderr, so redirect it to stdout:

ffmpeg -i bluearrow.mp4 -vf "freezedetect=n=0.01:d=5" -map  0:v:0 -f null - 2>&1 | grep -q 'lavfi.freezedetect.freeze_start: '

> 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....

See above.

But for writing the log into a file look into ffmpeg's -report option, that's 
what it's for.

-- 
LAST SHIP HOME                      --->> https://lastshiphome.de
Official Selection                          DOK.fest München 2018
German Ocean Film Award                        CineMare Kiel 2019
Best Documentary Feature   Wales International Film Festival 2020


More information about the ffmpeg-user mailing list