这是我在脚本中的 ffmpeg 调用:
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 \
-i "_$v" -i /home/john/Web/blackblog/_meta/graphics/watermark.png \
-filter_complex "[0:v][1:v] overlay_vaapi=25:25" -pix_fmt yuv420p \
-hide_banner -vcodec h264 -acodec aac "$filename.mp4"
它抛出这个错误:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5f654b2a1a00] All samples in data stream index:id [3:4] have zero duration, stream set to be discarded by default. Override using AVStream->discard or -discard for ffmpeg command.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid.mp4':
Metadata:
major_brand : isom
minor_version : 131072
compatible_brands: isomiso2mp41
creation_time : 2024-02-19T19:48:49.000000Z
com.android.manufacturer: Google
com.android.model: Pixel 6
com.android.capture.fps: 30.000000
Duration: 00:02:03.55, start: 0.000000, bitrate: 19964 kb/s
Stream #0:0[0x1](eng): Data: none (mett / 0x7474656D), 29 kb/s (default)
Metadata:
creation_time : 2024-02-19T19:48:49.000000Z
handler_name : MetaHandle
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 191 kb/s (default)
Metadata:
creation_time : 2024-02-19T19:48:49.000000Z
handler_name : SoundHandle
vendor_id : [0][0][0][0]
Stream #0:2[0x3](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 1920x1080, 19736 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 90k tbn (default)
Metadata:
creation_time : 2024-02-19T19:48:49.000000Z
handler_name : VideoHandle
vendor_id : [0][0][0][0]
Stream #0:3[0x4](eng): Data: none (mett / 0x7474656D) (default)
Metadata:
creation_time : 2024-02-19T19:48:49.000000Z
handler_name : MetaHandle
Input #1, png_pipe, from 'logo.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba(pc, gbr/unknown/unknown), 200x44 [SAR 11811:11811 DAR 50:11], 25 fps, 25 tbr, 25 tbn
Stream mapping:
Stream #0:2 (hevc) -> overlay_vaapi (graph 0)
Stream #1:0 (png) -> overlay_vaapi (graph 0)
overlay_vaapi:default (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 1:0' and the filter 'auto_scale_0'
[fc#0 @ 0x5f654b220b40] Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while filtering: Function not implemented
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 1:0' and the filter 'auto_scale_0'
[fc#0 @ 0x5f654b220b40] Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
[out#0/mp4 @ 0x5f654c418a40] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=N/A bitrate=N/A speed=N/A
Conversion failed!
当我从第一行删除所有参数时,它可以工作,但速度非常慢。当我打开硬件加速时,它给了我这个错误。我在 Arch linux 上运行它,这是以下输出ffmpeg -version
:
ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13.2.1 (GCC) 20230801
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
libavutil 58. 29.100 / 58. 29.100
libavcodec 60. 31.102 / 60. 31.102
libavformat 60. 16.100 / 60. 16.100
libavdevice 60. 3.100 / 60. 3.100
libavfilter 9. 12.100 / 9. 12.100
libswscale 7. 5.100 / 7. 5.100
libswresample 4. 12.100 / 4. 12.100
libpostproc 57. 3.100 / 57. 3.100