panic while creating video from single frame
Hello,
on Debian bookworm (12.9.)
ntsc-rs/target/release/ntsc-rs-cli -i "FILE.jpg" -p "FILE.json" -o "FILE.mp4"
results in
ntsc-rs v0.9.2
The application panicked (crashed).
Message: called `Result::unwrap()` on an `Err` value: BoolError { message: "Failed to find element factory with name 'x264enc' for creating element", filename: "USER/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gstreamer-0.23.5/src/element_factory.rs", function: "gstreamer::element_factory::ElementBuilder::build::{{closure}}", line: 286 }
Location: ntsc-rs/crates/gui/src/app/render_job.rs:210
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
The application panicked (crashed).
Message: panic in a function that cannot unwind
Location: core/src/panicking.rs:221
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
thread caused non-unwinding panic. aborting.
Same true for the binary standalone for Linux.
So looks something is missing (no complains during compilation). Looks like it is related to gstreamer? All *.deb dependencies are installed.
$ dpkg -l *gstreamer* | grep ^ii
ii gir1.2-gstreamer-1.0:amd64 1.22.0-2+deb12u1 amd64 GObject introspection data for the GStreamer library
ii gstreamer1.0-alsa:amd64 1.22.3-dmo1+deb12u5 amd64 GStreamer plugin for ALSA
ii gstreamer1.0-gl:amd64 1.22.3-dmo1+deb12u5 amd64 GStreamer plugins for GL
ii gstreamer1.0-libav:amd64 1:1.22.3-dmo1 amd64 FFmpeg plugin for GStreamer
ii gstreamer1.0-libav:i386 1:1.22.3-dmo1 i386 FFmpeg plugin for GStreamer
ii gstreamer1.0-nice:amd64 0.1.21-1 amd64 ICE library (GStreamer plugin)
ii gstreamer1.0-plugins-bad:amd64 1:1.22.3-dmo1+deb12u6 amd64 GStreamer plugins from the "bad" set
ii gstreamer1.0-plugins-base:amd64 1.22.3-dmo1+deb12u5 amd64 GStreamer plugins from the "base" set
ii gstreamer1.0-plugins-base:i386 1.22.3-dmo1+deb12u5 i386 GStreamer plugins from the "base" set
ii gstreamer1.0-plugins-good:amd64 1.22.3-dmo1+deb12u2 amd64 GStreamer plugins from the "good" set
ii gstreamer1.0-plugins-ugly:amd64 1:1.22.3-dmo1+deb12u1 amd64 GStreamer plugins from the "ugly" set
ii gstreamer1.0-x:amd64 1.22.3-dmo1+deb12u5 amd64 GStreamer plugins for X11 and Pango
ii libgstreamer-gl1.0-0:amd64 1.22.3-dmo1+deb12u5 amd64 GStreamer GL libraries
ii libgstreamer-plugins-bad1.0-0:amd64 1:1.22.3-dmo1+deb12u6 amd64 GStreamer development files for libraries from the "bad" set
ii libgstreamer-plugins-base1.0-0:amd64 1.22.3-dmo1+deb12u5 amd64 GStreamer libraries from the "base" set
ii libgstreamer-plugins-base1.0-0:i386 1.22.3-dmo1+deb12u5 i386 GStreamer libraries from the "base" set
ii libgstreamer-plugins-base1.0-dev:amd64 1.22.3-dmo1+deb12u5 amd64 GStreamer development files for libraries from the "base" set
ii libgstreamer1.0-0:amd64 1.22.0-2+deb12u1 amd64 Core GStreamer libraries and elements
ii libgstreamer1.0-0:i386 1.22.0-2+deb12u1 i386 Core GStreamer libraries and elements
ii libgstreamer1.0-dev:amd64 1.22.0-2+deb12u1 amd64 GStreamer core development files
With rust backtrace:
The application panicked (crashed).
Message: called `Result::unwrap()` on an `Err` value: BoolError { message: "Failed to find element factory with name 'x264enc' for creating element", filename: "/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gstreamer-0.23.5/src/element_factory.rs", function: "gstreamer::element_factory::ElementBuilder::build::{{closure}}", line: 286 }
Location: /home/runner/work/ntsc-rs/ntsc-rs/crates/gui/src/app/render_job.rs:210
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⋮ 8 frames hidden ⋮
9: gui::app::render_job::RenderJob::create::{{closure}}::h505bc844df581378
at <unknown source file>:<unknown line>
10: gui::gst_utils::ntsc_pipeline::NtscPipeline::try_new::{{closure}}::ha4239698e2065752
at <unknown source file>:<unknown line>
11: gstreamer::auto::element::ElementExt::connect_pad_added::pad_added_trampoline::hfaf06e37b0a0962f
at <unknown source file>:<unknown line>
12: g_cclosure_marshal_VOID__OBJECTv<unknown>
at <unknown source file>:<unknown line>
13: g_signal_emit_valist<unknown>
at <unknown source file>:<unknown line>
14: g_signal_emit<unknown>
at <unknown source file>:<unknown line>
15: gst_element_add_pad<unknown>
at <unknown source file>:<unknown line>
16: g_hook_list_marshal<unknown>
at <unknown source file>:<unknown line>
17: gst_pad_push_event<unknown>
at <unknown source file>:<unknown line>
18: gst_video_decoder_negotiate<unknown>
at <unknown source file>:<unknown line>
19: gst_video_decoder_have_frame<unknown>
at <unknown source file>:<unknown line>
20: gst_pad_push<unknown>
at <unknown source file>:<unknown line>
21: start_thread<unknown>
at ./nptl/pthread_create.c:442
22: clone3<unknown>
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
The application panicked (crashed).
Message: panic in a function that cannot unwind
Location: library/core/src/panicking.rs:218
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⋮ 6 frames hidden ⋮
7: core::panicking::panic_nounwind_fmt::h0d5ff668f956fac4
at <unknown source file>:<unknown line>
8: core::panicking::panic_nounwind::h385b7d9bda51382d
at <unknown source file>:<unknown line>
9: core::panicking::panic_cannot_unwind::h757b6ea37bf9b60a
at <unknown source file>:<unknown line>
10: gstreamer::auto::element::ElementExt::connect_pad_added::pad_added_trampoline::hfaf06e37b0a0962f
at <unknown source file>:<unknown line>
11: g_cclosure_marshal_VOID__OBJECTv<unknown>
at <unknown source file>:<unknown line>
12: g_signal_emit_valist<unknown>
at <unknown source file>:<unknown line>
13: g_signal_emit<unknown>
at <unknown source file>:<unknown line>
14: gst_element_add_pad<unknown>
at <unknown source file>:<unknown line>
15: g_hook_list_marshal<unknown>
at <unknown source file>:<unknown line>
16: gst_pad_push_event<unknown>
at <unknown source file>:<unknown line>
17: gst_video_decoder_negotiate<unknown>
at <unknown source file>:<unknown line>
18: gst_video_decoder_have_frame<unknown>
at <unknown source file>:<unknown line>
19: gst_pad_push<unknown>
at <unknown source file>:<unknown line>
20: start_thread<unknown>
at ./nptl/pthread_create.c:442
21: clone3<unknown>
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.
thread caused non-unwinding panic. aborting.
Using the standalone GUI version, same error:
./ntsc-rs/ntsc-rs/target/release/ntsc-rs-standalone
thread '<unnamed>' panicked at crates/gui/src/app/render_job.rs:210:84:
called `Result::unwrap()` on an `Err` value: BoolError { message: "Failed to find element factory with name 'x264enc' for creating element", filename: "/home/leo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gstreamer-0.23.5/src/element_factory.rs", function: "gstreamer::element_factory::ElementBuilder::build::{{closure}}", line: 286 }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at core/src/panicking.rs:221:5:
panic in a function that cannot unwind
stack backtrace:
0: 0x55748f6757da - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h304520fd6a30aa07
1: 0x55748f6a3c7b - core::fmt::write::hf5713710ce10ff22
2: 0x55748f670653 - std::io::Write::write_fmt::hda708db57927dacf
3: 0x55748f676b42 - std::panicking::default_hook::{{closure}}::he1ad87607d0c11c5
4: 0x55748f6767ae - std::panicking::default_hook::h81c8cd2e7c59ee33
5: 0x55748f6773cf - std::panicking::rust_panic_with_hook::had2118629c312a4a
6: 0x55748f677083 - std::panicking::begin_panic_handler::{{closure}}::h7fa5985d111bafa2
7: 0x55748f675cb9 - std::sys::backtrace::__rust_end_short_backtrace::h704d151dbefa09c5
8: 0x55748f676d44 - rust_begin_unwind
9: 0x55748ea99b85 - core::panicking::panic_nounwind_fmt::hc0ae93930ea8f76c
10: 0x55748ea99c12 - core::panicking::panic_nounwind::h9f485ff9b02bac75
11: 0x55748ea99d56 - core::panicking::panic_cannot_unwind::hea865182d7ce50af
12: 0x55748eb9064e - gstreamer::auto::element::ElementExt::connect_pad_added::pad_added_trampoline::he2087b5e16735871
13: 0x7ff6dcdc7611 - g_cclosure_marshal_VOID__OBJECTv
14: 0x7ff6dcdc45a9 - <unknown>
15: 0x7ff6dcdddbbf - g_signal_emit_valist
16: 0x7ff6dcddddbf - g_signal_emit
17: 0x7ff6dce78b91 - gst_element_add_pad
18: 0x7ff6db28b1ec - <unknown>
19: 0x7ff6db28c081 - <unknown>
20: 0x7ff6dce965ad - <unknown>
21: 0x7ff6dccb9f46 - g_hook_list_marshal
22: 0x7ff6dce95cf6 - <unknown>
23: 0x7ff6dce9987b - <unknown>
24: 0x7ff6dce99f98 - <unknown>
25: 0x7ff6dce9747e - <unknown>
26: 0x7ff6dcea30a6 - gst_pad_push_event
27: 0x7ff6dd020158 - <unknown>
28: 0x7ff6dd024d0f - gst_video_decoder_negotiate
29: 0x7ff6dbdedb8e - <unknown>
30: 0x7ff6dd026c12 - <unknown>
31: 0x7ff6dd02a9f2 - gst_video_decoder_have_frame
32: 0x7ff6dd01d71a - <unknown>
33: 0x7ff6dd026fd5 - <unknown>
34: 0x7ff6dd029c7a - <unknown>
35: 0x7ff6dce98369 - <unknown>
36: 0x7ff6dce9a871 - <unknown>
37: 0x7ff6dcea1c2b - gst_pad_push
38: 0x7ff6db35e71f - <unknown>
39: 0x7ff6dced1501 - <unknown>
40: 0x7ff6dccf56ca - <unknown>
41: 0x7ff6dccf4cfd - <unknown>
42: 0x7ff6dc83f1c4 - start_thread
at ./nptl/pthread_create.c:442:8
43: 0x7ff6dc8bf85c - clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
44: 0x0 - <unknown>
thread caused non-unwinding panic. aborting.
btw.- it works if switched to ffv1 codec so it seems a missing x264 encoder (?). It does not depend on the source material (image, video).
Thanks!
UPDATE
it seems the problem is that ntsc-rs (cli + standalone) cannot work together with the gstreamer version from deb-multimedia.org. The gstreamer1.0-plugins-bad contains x265 but gstreamer1.0-plugins-ugly does not contain x264.
Suggestion
Please add to the installation instructions a warning to avoid installing gstreamer1.0 from the deb-multimedia.org repo.
Which repo should I direct people to install gstreamer from?
Trying out Debian the "normal" Debian repo from debian.org and its mirrors -> it worked. On a different computer using gstreamer packages from deb-multimedia.org the cli + GUI crash and investigation shows x264 is missing in gstreamer. So there are two options:
- just install normal Debian and it should work (unless they remove x264 as well, have tested
bookworm, but nottrixieorsidyet)
which means avoid
-
gstreamerfrom deb-multimedia.org ie. doapt pinningforgstreameror do not use this repo at all
Will try to downgrade back to normal Debian and can leave a note here whether it worked.
For those who are unsure - to test on Debian (should work also for Ubuntu, Mint, etc.) for x264 encoder (using gstreamer)
Example x265 is present using deb-multimedia.org repo (gstreamer) and x264 is not present. On the terminal type
$ find /usr/lib/x86_64-linux-gnu/ -iname '*libgstx265*'
/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstx265.so
whereas the following brings no response:
$ find /usr/lib/x86_64-linux-gnu/ -iname '*libgstx264.so*'
$
To get ntsc-rs output to h264 working it MUST give an output like for x265 above.
To find out which packages are installed type
dpkg -l *gstreamer*|grep ^ii
and to find out which repo was used for which package type e.g.
apt policy gstreamer1.0-plugins-ugly