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

Bo Berglund bo.berglund at gmail.com
Wed Jul 7 21:23:48 EEST 2021


On Wed, 7 Jul 2021 09:02:47 -0700, Carl Zwanzig <cpz at tuunq.com> wrote:

>On 7/7/2021 8:48 AM, Bo Berglund wrote:
>> 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.
>
>Does that mean youtube continues to send duplicate frames (which are 
>received w/o error) or that no frames are received at all? The latter could 
>be noticed by watching the process network i/o (no received packets = no 
>received stream).

What happens is that the stream continues unabated but there is only a blue
triangle on the screen.

I downladed such a video and cut it down in size to about 3 minutes
(bluearrow.mp4) and ran the test on that local video just to see what would
happen.
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 -
ffmpeg version 4.3.2-0york0~18.04 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version='0york0~18.04'
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
--disable-stripping --enable-avresample --disable-filter=resample
--enable-gnutls --enable-ladspa --enable-libaom --enable-libass
--enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio
--enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype
--enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack
--enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt
--enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg
--enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora
--enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2
--enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx
--enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libzimg
--enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883
--enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bluearrow.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:03:10.01, start: 0.000000, bitrate: 145 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv,
bt709), 854x480 [SAR 1:1 DAR 427:240], 9 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
(default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo,
fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
    Stream #0:0(und): Video: wrapped_avframe, yuv420p, 854x480 [SAR 1:1 DAR
427:240], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.91.100 wrapped_avframe
[freezedetect @ 0x55ce112ce980] lavfi.freezedetect.freeze_start: 0
frame= 5700 fps=940 q=-0.0 Lsize=N/A time=00:03:10.00 bitrate=N/A speed=31.3x
video:2984kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: unknown

$ echo $?
0
-----------------------------------

Notice that the exit code was 0 ($?) even though the video was frozen regarding
the image.

So now at least ffmpeg did something (while doing so it displayed something like
30x indicating it did the processing at 30 times normal speed.

Yet it did not output a finding of "frozen" or similar.

How is this filter supposed to output a result and what does that result look
like?
I do not want another video, just a verdict that it is frozen or not.


-- 
Bo Berglund
Developer in Sweden



More information about the ffmpeg-user mailing list