![ffmpeg 卡在生成视频缩略图](https://linux22.com/image/1611553/ffmpeg%20%E5%8D%A1%E5%9C%A8%E7%94%9F%E6%88%90%E8%A7%86%E9%A2%91%E7%BC%A9%E7%95%A5%E5%9B%BE.png)
我目前正在编写一个脚本来创建文件夹中的视频缩略图,但只要 ffmpeg 遇到 .mov 视频,它就会卡住。这些视频是在 iPhone 上以 4k 60fps 拍摄的,可以毫无问题地播放,所以我知道它们没有损坏。为了提取图片,我在 2 台不同的机器上尝试了相同的命令并使用了不同类型的参数,但结果没有任何改变。
我尝试过的:
ffmpeg -i IMG_1001.MOV -ss 00:00:02 -vframes 1 thumbnail.jpg
它卡在倒数第三行frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed= 0x
,从那时起,我用 ctrl+c 停止了该过程
输出:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_1001.MOV': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2019-11-xx com.apple.quicktime.make: Apple com.apple.quicktime.model: iPhone 8 com.apple.quicktime.software: 13.2.2 com.apple.quicktime.creationdate: 2019-11-xx Duration: 00:00:05.18, start: 0.000000, bitrate: 54961 kb/s Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 3840x2160, 54851 kb/s, 60 fps, 60 tbr, 600 tbn, 600 tbc (default) Metadata: creation_time : 2019-11-xx handler_name : Core Media Data Handler encoder : HEVC Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 94 kb/s (default) Metadata: creation_time : 2019-11-xx handler_name : Core Media Data Handler Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2019-11-xx handler_name : Core Media Data Handler Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2019-11-xx handler_name : Core Media Data Handler Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> mjpeg (native)) Press [q] to stop, [?] for help [swscaler @ 0x55d83a288940] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to 'thumbnail.jpg': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt com.apple.quicktime.creationdate: 2019-11-xx com.apple.quicktime.make: Apple com.apple.quicktime.model: iPhone 8 com.apple.quicktime.software: 13.2.2 encoder : Lavf57.83.100 Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 3840x2160, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc (default) Metadata: creation_time : 2019-11-xx handler_name : Core Media Data Handler encoder : Lavc57.107.100 mjpeg Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed= 0x video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
知道可能是什么吗?我遗漏了什么,还是 ffmpeg 无法正确读取编码?除此之外,我还没有找到在 Linux 上从视频生成缩略图的其他方法
答案1
我刚刚使用了旧版本的 ffmpeg(位于 debian 存储库中)。下载最近的静态构建并使用那个解决了卡住的问题。