1

我正在尝试使用从网络摄像头拍摄的图像制作长达一年的定格视频。我在input.txt里面创建了一个这种格式的文件:

ffconcat version 1.0

file 'amianthe201909031230.jpg'
duration 0.093034825870647

file 'amianthe201909031330.jpg'
duration 0.093034825870647

我制作的命令(主要取自官方 ffmpeg 文档中的示例)是:

ffmpeg \
    -y \
    -hwaccel vaapi \
    -hwaccel_device /dev/dri/renderD128 \
    -hwaccel_output_format vaapi \
    -f concat \
    -i input.txt \
    -vf 'hwmap=mode=read+write+direct,format=nv12,ass=subtitles.ass,hwmap' \
    -c:v h264_vaapi \
    ~/amianthe.mp4

但是这个输出严重失败:

ffmpeg version 4.1.4-1build2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.2.1-4ubuntu1)
  configuration: --prefix=/usr --extra-version=1build2 --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-avisynth --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --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-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, concat, from 'input.txt':
  Duration: 00:00:18.70, start: 0.000000, bitrate: 5 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (h264_vaapi))
Press [q] to stop, [?] for help
[Parsed_ass_2 @ 0x5557f4ec4ac0] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 2.6.1 (COMPLEX)
[Parsed_ass_2 @ 0x5557f4ec4ac0] Using font provider fontconfig
[Parsed_ass_2 @ 0x5557f4ec4ac0] Added subtitle file: 'subtitles.ass' (4 styles, 2 events)
[Parsed_hwmap_3 @ 0x5557f5381ec0] Unsupported formats for hwmap: from nv12 (vaapi_vld) to vaapi_vld.
[Parsed_hwmap_3 @ 0x5557f5381ec0] Failed to configure output pad on Parsed_hwmap_3
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

老实说,我迷失了:根据我的理解,所有的阐述都应该直接在视频卡内存中完成,所以我不明白为什么要转换表面格式。还有其他一些我必须输入的参数format吗?我错过了什么?

4

0 回答 0