Open fracnesco opened 1 month ago
I think I've found the bug:
The call to mb_type_func
(ret = ff_script_call_func(script, NULL, s->mb_type_func, func_args, NULL);
in mpegvideo_enc.c
) is called from a different thread from which script
was created in ff_mpv_encode_init()
, and quickjs
does not like that.
At least that's what it seems like. But I won't have time to fix it right now :/.
Seems like I'm hitting the same error with -pict_type_script
:
ffgac -i turbo_killer_trimmed.mp4 \
-pict_type_script ../bpm_iframes.js \
-vcodec mpeg2video \
-f rawvideo \
-y p_tk_nopimb_forcemv_scale0_gmax_scthrshold_max.mpg
With the error being :
[quickjs @ 0x14e00aa00] [exception]
[quickjs @ 0x14e00aa00]
[quickjs @ 0x14e00aa00] Error calling pict_type_func() function in ../bpm_iframes.js
[vost#0:0/mpeg2video @ 0x14d106ee0] Error submitting video frame to the encoder
[vost#0:0/mpeg2video @ 0x14d106ee0] Error encoding a frame: Operation not permitted
[vost#0:0/mpeg2video @ 0x14d106ee0] Task finished with error code: -1 (Operation not permitted)
[vost#0:0/mpeg2video @ 0x14d106ee0] Terminating thread with return code -1 (Operation not permitted)
When running this on windows:
./bin/ffgac.exe -i CEP00109_mpeg4.avi -vcodec mpeg4 -an -mb_type_script mb_type.js -f rawvideo -y NUL
export function mb_type_func(args) { console.log("glitchframe") }
I get this error:
ffgac version ffglitch-0.10.2 Copyright (c) 2000-2024 the FFmpeg developers FFglitch Copyright (c) 2017-2024 Ramiro Polla built with gcc 12-posix (GCC) configuration: --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw64 --extra-ldflags=-static --pkg-config-flags=--static --disable-doc --enable-gpl --enable-static --disable-shared --disable-autodetect --disable-iconv --enable-zlib --enable-libxvid --enable-sdl2 --enable-rtmidi --enable-libzmq Input #0, avi, from 'CEP00109_mpeg4.avi': Metadata: software : Lavf58.45.100 Duration: 00:00:09.34, start: 0.000000, bitrate: 3201 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 3196 kb/s, 59.94 fps, 29.97 tbr, 59.94 tbn Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> mpeg4 (native)) Press [q] to stop, [?] for help Output #0, rawvideo, to 'NUL': Metadata: software : Lavf58.45.100 encoder : Lavf61.1.100 Stream #0:0: Video: mpeg4, yuv420p(progressive), 720x480 [SAR 8:9 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn Metadata: encoder : Lavc61.3.100 mpeg4 Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A [quickjs @ 000001e1c51b00c0] [exception] [quickjs @ 000001e1c51b00c0] [quickjs @ 000001e1c51b00c0] Error calling mb_type_func() function in mb_type.js [vost#0:0/mpeg4 @ 000001e1c3315c00] Error submitting video frame to the encoder [vost#0:0/mpeg4 @ 000001e1c3315c00] Error encoding a frame: Operation not permitted [vost#0:0/mpeg4 @ 000001e1c3315c00] Task finished with error code: -1 (Operation not permitted) [vost#0:0/mpeg4 @ 000001e1c3315c00] Terminating thread with return code -1 (Operation not permitted) [out#0/rawvideo @ 000001e1c32f6f00] video:42KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.000000% frame= 1 fps=0.0 q=7.1 Lsize= 42KiB time=00:00:00.03 bitrate=10285.4kbits/s speed=1.21x Assertion failed: list_empty(&rt->gc_obj_list), file src/libavutil/quickjs/quickjs.c, line 2094