Vinlic / WebVideoCreator

🌈 A framework for rendering web animations into videos. It's implemented based on Node.js + Puppeteer + Chrome + FFmpeg, utilizing the latest browser APIs.
Apache License 2.0
94 stars 26 forks source link

Error: Resource not currently part of this pool #12

Closed garywill closed 6 months ago

garywill commented 7 months ago

1。

[2023-12-04 14:43:06.348][error][SingleVideo<116,34>] Error: Resource not currently part of this pool
at Pool.release (/tmp/wvc/node_modules/generic-pool/lib/Pool.js:518:9)
at Browser.releasePage (file:///tmp/wvc/node_modules/web-video-creator/core/Browser.js:219:30)
at file:///tmp/wvc/node_modules/web-video-creator/core/Page.js:862:31
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

总是卡在上面这里(设置为使用cpu软件来编码)

2。 另外,我发现只有将encoder设置为cpu才可以达到上面这里 我是intel集成显卡,试了vaapi、qsv等,都报以下错误,似乎还不如上面

[2023-12-04 14:45:53.782][error][Synthesizer<376,20>] Error: Video codec h264_qsv is not available
at /tmp/wvc/node_modules/fluent-ffmpeg/lib/capabilities.js:656:21
at nextTask (/tmp/wvc/node_modules/async/dist/async.js:5791:13)
at next (/tmp/wvc/node_modules/async/dist/async.js:5799:13)
at /tmp/wvc/node_modules/async/dist/async.js:329:20
at /tmp/wvc/node_modules/fluent-ffmpeg/lib/capabilities.js:484:7
at handleExit (/tmp/wvc/node_modules/fluent-ffmpeg/lib/processor.js:170:11)
at ChildProcess.<anonymous> (/tmp/wvc/node_modules/fluent-ffmpeg/lib/processor.js:184:11)
at ChildProcess.emit (node:events:514:28)

3。 另外,如果调整duration数字小一点,就会有

[2023-12-04 14:41:49.445][error][Synthesizer<376,20>] Error: config frameCount 0 is invalid
at evaluate (evaluate at file:///tmp/wvc/node_modules/web-video-creator/core/Page.js:363:31, <anonymous>:4:81)
at #evaluate (file:///tmp/wvc/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:226:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ExecutionContext.evaluate (file:///tmp/wvc/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:123:16)
at async IsolatedWorld.evaluate (file:///tmp/wvc/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/IsolatedWorld.js:125:16)
at async CdpFrame.evaluate (file:///tmp/wvc/node_modules/puppeteer-core/lib/esm/puppeteer/api/Frame.js:360:20)
at async CdpPage.evaluate (file:///tmp/wvc/node_modules/puppeteer-core/lib/esm/puppeteer/api/Page.js:717:20)
at async file:///tmp/wvc/node_modules/web-video-creator/core/Page.js:363:13
at start (:1558:13)
at _checkConfig (:1657:18)

环境是linux上的node20

Vinlic commented 7 months ago

@garywill 能否提供您渲染的页面 以及处理器型号 需要这些信息协助检查

garywill commented 7 months ago

页面就是readme里的这个例子。在浏览器中打开是可以看见红色三角形转动的

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>测试页面</title>
    </head>
    <body>
        <svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1"
        xmlns:xlink="http://www.w3.org/1999/xlink">
            <polygon points="60,30 90,90 30,90" fill="red">
                <animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0 60 70" to="360 60 70"
                    dur="10s" repeatCount="indefinite" />
            </polygon>
        </svg>
    </body>
</html>

显卡(Linux x64 X11)

VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
Subsystem: Lenovo Device 21fc
Kernel driver in use: i915
Kernel modules: i915

运行它下载的那个chrome,chrome://gpu导出信息: about-gpu-2023-12-05T02-19-24-143Z.txt

cpu

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i3-3110M CPU @ 2.40GHz
stepping        : 9
microcode       : 0x21
cpu MHz         : 2164.471
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx f16c lahf_lm cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow vnmiflexpriority ept vpid fsgsbase smep erms xsaveopt dtherm arat pln pts md_clear flush_l1d
vmx flags       : vnmi preemption_timer invvpid ept_x_only flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit mmio_unknown
bogomips        : 4789.10
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:
Vinlic commented 7 months ago

@garywill 您是否使用了虚拟机或是WSL?据我所知i3-3110M应该支持Intel QSV

garywill commented 7 months ago

没有用任何虚拟或容器,实机linux

前段时间我这里试过其他软件vaapi转视频,是可以的

我觉得是否qsv不是重点,现在是使用cpu软编都不行 能解决我汇报的第1点的话,就至少还能用

Vinlic commented 7 months ago

@garywill 使用了哪个Linux发行版,我需要复现一下它

garywill commented 7 months ago

opensuse 15.5

大哥辛苦了~

Vinlic commented 7 months ago

@garywill 好的,我可能需要花一些时间去验证,目前在ubuntu未发生这样得问题。

garywill commented 7 months ago

呃等下。。 我原本是把duration改成了300想减少点试试(fps也降低) 好像改回readme中的10000后可以了。duration至少400才可以。。。。 还和fps与duration和互相组合有关

不过qsv和vaapi还是不行

Vinlic commented 7 months ago

@garywill 好的,这里的时间是毫秒,确实缺少对于超短时长的测试,我会在今晚验证一下 至于qsv的调用问题,您能否在命令行使用ffmpeg尝试一下使用h264_qsv转码一个mp4文件来检查一下 或者用wvc.config({ ffmpegDebug: true }),打开ffmpegDebug选项输出ffmpeg执行的命令

Vinlic commented 7 months ago

@garywill 针对第一个问题,在短时长低帧率的时候,例如300毫秒 15fps时,视频只有4帧,4帧不足以填满缓冲区,导致缓冲区拼接异常。 已经修复,将会在接下来的0.0.31版本更新。 修复缓冲区存在空帧时无法拼接的问题

Vinlic commented 7 months ago

你可以通过以下命令验证您的qsv编码器是否工作,需要先安装好ffmpeg 😸 : ffmpeg -i input.mp4 -c:v h264_qsv out.mp4 @garywill

garywill commented 7 months ago

加了ffmpegDebug: true后并没有增加什么输出信息

我看了下node_modules里的静态ffmpeg文件,列出的编码器里没有qsv或vaapi,估计是这个原因

$ ./node_modules/ffmpeg-static/ffmpeg -encoders
ffmpeg version 6.0-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex--enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil      58.  2.100 / 58.  2.100
libavcodec     60.  3.100 / 60.  3.100
libavformat    60.  3.100 / 60.  3.100
libavdevice    60.  1.100 / 60.  1.100
libavfilter     9.  3.100 /  9.  3.100
libswscale      7.  1.100 /  7.  1.100
libswresample   4. 10.100 /  4. 10.100
libpostproc    57.  1.100 / 57.  1.100
Encoders:
V..... = Video
A..... = Audio
S..... = Subtitle
.F.... = Frame-level multithreading
..S... = Slice-level multithreading
...X.. = Codec is experimental
....B. = Supports draw_horiz_band
.....D = Supports direct rendering method 1
------
V....D a64multi             Multicolor charset for Commodore 64 (codec a64_multi)
V....D a64multi5            Multicolor charset for Commodore 64, extended with 5th color (colram) (codec a64_multi5)
V....D alias_pix            Alias/Wavefront PIX image
V..... amv                  AMV Video
V....D apng                 APNG (Animated Portable Network Graphics) image
V....D asv1                 ASUS V1
V....D asv2                 ASUS V2
V....D libaom-av1           libaom AV1 (codec av1)
V....D avrp                 Avid 1:1 10-bit RGB Packer
V..X.D avui                 Avid Meridien Uncompressed
V....D ayuv                 Uncompressed packed MS 4:4:4:4
VF...D bitpacked            Bitpacked
V....D bmp                  BMP (Windows and OS/2 bitmap)
VF...D cfhd                 GoPro CineForm HD
V....D cinepak              Cinepak
V....D cljr                 Cirrus Logic AccuPak
V.S..D vc2                  SMPTE VC-2 (codec dirac)
VFS..D dnxhd                VC3/DNxHD
V....D dpx                  DPX (Digital Picture Exchange) image
VFS..D dvvideo              DV (Digital Video)
VF...D exr                  OpenEXR image
V.S..D ffv1                 FFmpeg video codec #1
VF...D ffvhuff              Huffyuv FFmpeg variant
V....D fits                 Flexible Image Transport System
V....D flashsv              Flash Screen Video
V....D flashsv2             Flash Screen Video Version 2
V..... flv                  FLV / Sorenson Spark / Sorenson H.263 (Flash Video) (codec flv1)
V....D gif                  GIF (Graphics Interchange Format)
V..... h261                 H.261
V..... h263                 H.263 / H.263-1996
V..... h263_v4l2m2m         V4L2 mem2mem H.263 encoder wrapper (codec h263)
V.S... h263p                H.263+ / H.263-1998 / H.263 version 2
V....D libx264              libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
V....D libx264rgb           libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)
V..... h264_v4l2m2m         V4L2 mem2mem H.264 encoder wrapper (codec h264)
VF...D hdr                  HDR (Radiance RGBE format) image
V....D libx265              libx265 H.265 / HEVC (codec hevc)
V..... hevc_v4l2m2m         V4L2 mem2mem HEVC encoder wrapper (codec hevc)
VF...D huffyuv              Huffyuv / HuffYUV
V....D jpeg2000             JPEG 2000
VF.... libopenjpeg          OpenJPEG JPEG 2000 (codec jpeg2000)
VF...D jpegls               JPEG-LS
VF...D ljpeg                Lossless JPEG
VF...D magicyuv             MagicYUV video
VFS... mjpeg                MJPEG (Motion JPEG)
V.S... mpeg1video           MPEG-1 video
V.S... mpeg2video           MPEG-2 video
V.S... mpeg4                MPEG-4 part 2
V....D libxvid              libxvidcore MPEG-4 part 2 (codec mpeg4)
V..... mpeg4_v4l2m2m        V4L2 mem2mem MPEG4 encoder wrapper (codec mpeg4)
V..... msmpeg4v2            MPEG-4 part 2 Microsoft variant version 2
V..... msmpeg4              MPEG-4 part 2 Microsoft variant version 3 (codec msmpeg4v3)
V..... msvideo1             Microsoft Video-1
V....D pam                  PAM (Portable AnyMap) image
V....D pbm                  PBM (Portable BitMap) image
V....D pcx                  PC Paintbrush PCX image
V....D pfm                  PFM (Portable FloatMap) image
V....D pgm                  PGM (Portable GrayMap) image
V....D pgmyuv               PGMYUV (Portable GrayMap YUV) image
V....D phm                  PHM (Portable HalfFloatMap) image
VF...D png                  PNG (Portable Network Graphics) image
V....D ppm                  PPM (Portable PixelMap) image
VF...D prores               Apple ProRes
VF...D prores_aw            Apple ProRes (codec prores)
VFS... prores_ks            Apple ProRes (iCodec Pro) (codec prores)
VF...D qoi                  QOI (Quite OK Image format) image
V....D qtrle                QuickTime Animation (RLE) video
V....D r10k                 AJA Kona 10-bit RGB Codec
V....D r210                 Uncompressed RGB 10-bit
VF...D rawvideo             raw video
V....D roqvideo             id RoQ video (codec roq)
V....D rpza                 QuickTime video (RPZA)
V..... rv10                 RealVideo 1.0
V..... rv20                 RealVideo 2.0
V....D sgi                  SGI image
V....D smc                  QuickTime Graphics (SMC)
V....D snow                 Snow
V..... speedhq              NewTek SpeedHQ
V....D sunrast              Sun Rasterfile image
V....D svq1                 Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1
V....D targa                Truevision Targa image
V....D libtheora            libtheora Theora (codec theora)
VF...D tiff                 TIFF image
VF...D utvideo              Ut Video
VF...D v210                 Uncompressed 4:2:2 10-bit
V....D v308                 Uncompressed packed 4:4:4
V....D v408                 Uncompressed packed QT 4:4:4:4
V....D v410                 Uncompressed 4:4:4 10-bit
V.S..D vbn                  Vizrt Binary Image
V..... vnull                null video
V....D libvpx               libvpx VP8 (codec vp8)
V..... vp8_v4l2m2m          V4L2 mem2mem VP8 encoder wrapper (codec vp8)
V....D libvpx-vp9           libvpx VP9 (codec vp9)
VF...D wbmp                 WBMP (Wireless Application Protocol Bitmap) image
V....D libwebp_anim         libwebp WebP image (codec webp)
V....D libwebp              libwebp WebP image (codec webp)
V..... wmv1                 Windows Media Video 7
V..... wmv2                 Windows Media Video 8
V..... wrapped_avframe      AVFrame to AVPacket passthrough
V....D xbm                  XBM (X BitMap) image
V....D xface                X-face image
V....D xwd                  XWD (X Window Dump) image
V....D y41p                 Uncompressed YUV 4:1:1 12-bit
V....D yuv4                 Uncompressed packed 4:2:0
VF...D zlib                 LCL (LossLess Codec Library) ZLIB
V....D zmbv                 Zip Motion Blocks Video
A....D aac                  AAC (Advanced Audio Coding)
A....D ac3                  ATSC A/52A (AC-3)
A....D ac3_fixed            ATSC A/52A (AC-3) (codec ac3)
A....D adpcm_adx            SEGA CRI ADX ADPCM
A....D adpcm_argo           ADPCM Argonaut Games
A....D g722                 G.722 ADPCM (codec adpcm_g722)
A....D g726                 G.726 ADPCM (codec adpcm_g726)
A....D g726le               G.726 little endian ADPCM ("right-justified") (codec adpcm_g726le)
A....D adpcm_ima_alp        ADPCM IMA High Voltage Software ALP
A....D adpcm_ima_amv        ADPCM IMA AMV
A....D adpcm_ima_apm        ADPCM IMA Ubisoft APM
A....D adpcm_ima_qt         ADPCM IMA QuickTime
A....D adpcm_ima_ssi        ADPCM IMA Simon & Schuster Interactive
A....D adpcm_ima_wav        ADPCM IMA WAV
A....D adpcm_ima_ws         ADPCM IMA Westwood
A....D adpcm_ms             ADPCM Microsoft
A....D adpcm_swf            ADPCM Shockwave Flash
A....D adpcm_yamaha         ADPCM Yamaha
A....D alac                 ALAC (Apple Lossless Audio Codec)
A....D libopencore_amrnb    OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band) (codec amr_nb)
A....D libvo_amrwbenc       Android VisualOn AMR-WB (Adaptive Multi-Rate Wide-Band) (codec amr_wb)
A..... anull                null audio
A....D aptx                 aptX (Audio Processing Technology for Bluetooth)
A....D aptx_hd              aptX HD (Audio Processing Technology for Bluetooth)
A....D comfortnoise         RFC 3389 comfort noise generator
A....D dfpwm                DFPWM1a audio
A..X.D dca                  DCA (DTS Coherent Acoustics) (codec dts)
A....D eac3                 ATSC A/52 E-AC-3
A....D flac                 FLAC (Free Lossless Audio Codec)
A....D g723_1               G.723.1
A..X.D mlp                  MLP (Meridian Lossless Packing)
A....D mp2                  MP2 (MPEG audio layer 2)
A....D mp2fixed             MP2 fixed point (MPEG audio layer 2) (codec mp2)
A....D libmp3lame           libmp3lame MP3 (MPEG audio layer 3) (codec mp3)
A....D nellymoser           Nellymoser Asao
A..X.D opus                 Opus
A....D libopus              libopus Opus (codec opus)
A....D pcm_alaw             PCM A-law / G.711 A-law
A....D pcm_bluray           PCM signed 16|20|24-bit big-endian for Blu-ray media
A....D pcm_dvd              PCM signed 16|20|24-bit big-endian for DVD media
A....D pcm_f32be            PCM 32-bit floating point big-endian
A....D pcm_f32le            PCM 32-bit floating point little-endian
A....D pcm_f64be            PCM 64-bit floating point big-endian
A....D pcm_f64le            PCM 64-bit floating point little-endian
A....D pcm_mulaw            PCM mu-law / G.711 mu-law
A....D pcm_s16be            PCM signed 16-bit big-endian
A....D pcm_s16be_planar     PCM signed 16-bit big-endian planar
A....D pcm_s16le            PCM signed 16-bit little-endian
A....D pcm_s16le_planar     PCM signed 16-bit little-endian planar
A....D pcm_s24be            PCM signed 24-bit big-endian
A....D pcm_s24daud          PCM D-Cinema audio signed 24-bit
A....D pcm_s24le            PCM signed 24-bit little-endian
A....D pcm_s24le_planar     PCM signed 24-bit little-endian planar
A....D pcm_s32be            PCM signed 32-bit big-endian
A....D pcm_s32le            PCM signed 32-bit little-endian
A....D pcm_s32le_planar     PCM signed 32-bit little-endian planar
A....D pcm_s64be            PCM signed 64-bit big-endian
A....D pcm_s64le            PCM signed 64-bit little-endian
A....D pcm_s8               PCM signed 8-bit
A....D pcm_s8_planar        PCM signed 8-bit planar
A....D pcm_u16be            PCM unsigned 16-bit big-endian
A....D pcm_u16le            PCM unsigned 16-bit little-endian
A....D pcm_u24be            PCM unsigned 24-bit big-endian
A....D pcm_u24le            PCM unsigned 24-bit little-endian
A....D pcm_u32be            PCM unsigned 32-bit big-endian
A....D pcm_u32le            PCM unsigned 32-bit little-endian
A....D pcm_u8               PCM unsigned 8-bit
A....D pcm_vidc             PCM Archimedes VIDC
A....D real_144             RealAudio 1.0 (14.4K) (codec ra_144)
A....D roq_dpcm             id RoQ DPCM
A..X.D s302m                SMPTE 302M
A....D sbc                  SBC (low-complexity subband codec)
A..X.D sonic                Sonic
A..X.D sonicls              Sonic lossless
A....D libspeex             libspeex Speex (codec speex)
A..X.D truehd               TrueHD
A....D tta                  TTA (True Audio)
A..X.D vorbis               Vorbis
A....D libvorbis            libvorbis (codec vorbis)
A....D wavpack              WavPack
A....D wmav1                Windows Media Audio 1
A....D wmav2                Windows Media Audio 2
S..... ssa                  ASS (Advanced SubStation Alpha) subtitle (codec ass)
S..... ass                  ASS (Advanced SubStation Alpha) subtitle
S..... dvbsub               DVB subtitles (codec dvb_subtitle)
S..... dvdsub               DVD subtitles (codec dvd_subtitle)
S..... mov_text             3GPP Timed Text subtitle
S..... srt                  SubRip subtitle (codec subrip)
S..... subrip               SubRip subtitle
S..... text                 Raw text subtitle
S..... ttml                 TTML subtitle
S..... webvtt               WebVTT subtitle
S..... xsub                 DivX subtitles (XSUB)

(而我系统里的ffmpeg列出的是,有vaapi,无qsv)

而在上面表中,我看见了v4l2,下次我尝试下

以及我的系统里和驱动方面的,晚上我再尝试

Vinlic commented 7 months ago

@garywill 这确实不太正常,我在windows系统上测试,ffmpeg-static内的二进制文件输出了h264_qsv,我觉得可能和ffmpeg-static的下载来源有关,晚些我会调查一下。

garywill commented 7 months ago

猜测他们的静态编译是不是阉割了linux的硬件加速 linux的发行版众多,涉及显卡等硬件的,做静态可能难一点

我觉得作为workaround,你可以允许用户指定ffmpeg路径

Vinlic commented 7 months ago

@garywill 其实是可以指定的

wvc.config({
    ffmpegExecutablePath: "..."
});
garywill commented 7 months ago

qsv没有成功,但vaapi在系统中成功~!

需要添加一些vaapi需要的ffmpeg选项,并不是只设个-c:v就行的。 我使用以下命令成功在系统里做vaapi转换

ffmpeg  -hwaccel vaapi   -i  input.mkv  -vf 'hwupload'  -acodec copy  -vcodec h264_vaapi output.mp4

我是参考这里的 https://gist.github.com/Brainiarc7/95c9338a737aa36d9bb2931bed379219 , 他推荐的命令是

ffmpeg -loglevel debug -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i "input
file" -vf 'format=nv12,hwupload' -map 0:0 -map 0:1 -threads 8 -aspect
16:9 -y -f matroska -acodec copy -b:v 12500k -vcodec h264_vaapi
"output file"

WVC里,先指定了使用系统的ffmpeg,没有再提示找不到h264_vaapi。 但有新的报错

[2023-12-05 23:37:38.163][debug][util<455,16>] ffmpeg -f image2pipe -r 30 -hide_banner -i pipe:0 -y -b:v 2560k-vcodec h264_vaapi -filter:v scale=w=1280:h=720 -profile:v main -preset medium -pix_fmt yuv420p -movflags +faststart -f mp4 /tmp/wvc/tmp/synthesizer/video_1gw16bdgflpsi7uqq.mp4
[2023-12-05 23:37:46.948][error][Synthesizer<376,20>] Error: ffmpeg exited with code 1: Incompatible pixel format 'yuv420p' for codec 'h264_vaapi', auto-selecting format 'vaapi_vld'
Impossible to convert between the formats supported by the filter 'Parsed_scale_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
Conversion failed!

at ChildProcess.<anonymous> (/tmp/wvc/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
at ChildProcess.emit (node:events:514:28)
at ChildProcess._handle.onexit (node:internal/child_process:294:12)

感觉现在只需要WVC能够设置成使用-hwaccel vaapi -i input.mkv -vf 'hwupload' 这样的参数运行ffmpeg

那么,命令参数能自定义的吗?

Vinlic commented 7 months ago

@garywill -hwaccel实际上指定的是硬件解码器,WVC只用到硬件编码器,所以应该使用-c:v

garywill commented 7 months ago

-hwaccel实际上指定的是硬件解码器

可能ffmpeg的编码和解码器的组合还是有讲究的, 我这里试验的结果是, 只有在这三个选项都有的情况下,才能使用vaapi而不报错:

  1. -hwaccel vaapi
  2. -vf 'hwupload'
  3. -vcodec h264_vaapi (-vcodec-c:v是同样意思的吧)
Vinlic commented 7 months ago

@garywill 您在本机的ffmpeg试验过-vcodec h264_qsv吗,qsv的硬件加速应该更好,vaapi是Linux所支持的。

garywill commented 7 months ago

您在本机的ffmpeg试验过-vcodec h264_qsv吗

试过,不成功。按照网上的教程,除了-vcodec h264_qsv,还要加其他选项的,但我这里尝试了都报错

Vinlic commented 7 months ago

@garywill 尝试这个版本是否可用: https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz 我在centos可以正常调用qsv

garywill commented 7 months ago

尝试这个版本是否可用:https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz

在我这里不行。。 ./ffmpeg -encoders列出的里面,无qsv,无vaapi

Vinlic commented 7 months ago

@garywill 那也许真的和系统驱动相关,或者可以试一下这个方案: https://en.opensuse.org/FFmpeg

thanhtoan1196 commented 6 months ago

I have the same error, how do I fix it?

Vinlic commented 6 months ago

@thanhtoan1196 Please provide the calling code and error information so that we can investigate the cause. 😄