[FFmpeg-user] How to check if a youtube URL is valid before starting download?
Leo Butler
leo.butler81 at googlemail.com
Thu Jul 8 23:22:24 EEST 2021
Bo Berglund <bo.berglund at gmail.com> writes:
> Here is the complete result including my test of the exit code of ffmpeg:
>
> ----------------
> $ ffmpeg -i bluearrow.mp4 -vf "freezedetect=n=0.01:d=5" -map 0:v:0 -f null -
> [freezedetect @ 0x55ce112ce980] lavfi.freezedetect.freeze_start: 0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> $ echo $?
> 0
> -----------------------------------
>
> Notice that the exit code was 0 ($?) even though the video was frozen regarding
> the image.
ffmpeg exited without error, so the exit code should be 0.
Indeed, finding or not finding a freeze should not be signalled via exit
code, I think.
> 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=$?
O! ffmpeg sends stuff to stdout and stderr in random ways, so you will
need to redirect stderr to stdout, I suspect.
Leo
More information about the ffmpeg-user
mailing list