clapper
clapper copied to clipboard
Error opening a h264 video - Failed to connect stream: Invalid argument
- I open Clapper using command line.
- I enabled playbin3 option and disabled Pipewire audio support.
- Open a h264 video using Clapper using Open Files.
- Window is black and the error occurred. (com.github.rafostar.Clapper:11584): Clapper-CRITICAL **: 12:27:45.332: Error from element /GstPlayBin3:playbin3/GstPlaySink:playsink/GstBin:abin/GstAutoAudioSink:audiosink/GstPulseSink:audiosink-actual-sink-pulse: GStreamer encountered a general resource error. Failed to connect stream: Invalid argument ../ext/pulse/pulsesink.c(1078): gst_pulseringbuffer_acquire (): /GstPlayBin3:playbin3/GstPlaySink:playsink/GstBin:abin/GstAutoAudioSink:audiosink/GstPulseSink:audiosink-actual-sink-pulse
5.Do not close Clapper, open a h264 video again using Open Files, Then the video can be played.
Can someone help?
GStreamer version is 1.20.1
Does this also happen with playbin2 (disable playbin3 and restart the player)?
Hello, if i disable playbin3, errors are always reported and window is black.
(com.github.rafostar.Clapper:3931): Clapper-CRITICAL **: 06:42:55.511: Error from element /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:abin/GstPulseSink:pulsesink0: GStreamer encountered a general resource error. Failed to connect stream: Invalid argument ../ext/pulse/pulsesink.c(1078): gst_pulseringbuffer_acquire (): /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:abin/GstPulseSink:pulsesink0
(com.github.rafostar.Clapper:3931): Clapper-CRITICAL **: 06:43:14.280: Error from element /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:abin/GstPulseSink:pulsesink0: GStreamer encountered a general resource error. Failed to connect stream: Invalid argument ../ext/pulse/pulsesink.c(1078): gst_pulseringbuffer_acquire (): /GstPlayBin:playbin/GstPlaySink:playsink/GstBin:abin/GstPulseSink:pulsesink0
Start with below:
GST_DEBUG_NO_COLOR=1 GST_DEBUG=*pulse*:5,3 GST_DEBUG_FILE="$HOME/Videos/gstreamer.log" clapper
Try to play something with failure and attach generated gstreamer.log file in comment.
This seems like pulseaudio is having problems opening a connection with GStreamer process. Probably either your pulseaudio configuration is broken (do you/your distro have some predefined/initial config files?) on your OS or this might be a hardware/driver specific bug.
You can also try with ALSA instead of pulseaudio if its broken on your system for some reason:
GST_PLUGIN_FEATURE_RANK=alsasink:300 clapper
This is unrelated, but I also see in your log that v4l2codecs fails to initialize h264 decoder, which leads me to believe that this is some kind of embedded ARM machine you are using. Make sure you are using a recent mainline kernel (if possible), as otherwise hardware accelerated decoding will not work anyway.
Thank you for your reply ! Yes, I run Linux 5.16 kernel on RK3399 and the hardware decoding of H264 is ok after opening the video for the second time using Open Files.
@baiywt
Please try with alsa sink using cmd I mentioned earlier.
hardware decoding of H264 is ok
If v4l2codecs h264 stateless decoder fails to register, which decoder is used then? :thinking:
gstreamer.log
I think it worked
GST_DEBUG_NO_COLOR=1 GST_DEBUG=pulse:5,3 GST_DEBUG_FILE="$HOME/Videos/gstreamer.log" GST_PLUGIN_FEATURE_RANK=alsasink:300 clapper
The window is still black using alsa sink gstreamer.log
Does the problem appears only with AC-3 audio? Have you tried with a video that has a different audio codec?
No, let me try
@Rafostar Hello, vp8 and VP9 videos do not have this problem.
@Rafostar Hello, vp8 and VP9 videos do not have this problem.
The problem here is with audio, what audio codec do those streams that work use? Please check the name of used audio decoder (in next popover button to video one) for both streams that work on the first try and the one that works only on second opening for comparison.
As you say, the problem appears only with AC-3 audio, I tried to play the h264 video with mp3 audio is ok.
Please check the name of used audio decoder (in next popover button to video one)
If it fail, that button does not show.
If it fail, that button does not show.
Even on second file open when you manage to actually play video?
Also if this is some non-flatpak installation of Clapper, please make sure you have gstreamer1.0-plugins-ugly package installed or compiled with liba52 if you were compiling gstreamer yourself.
Even on second file open when you manage to actually play video?
No, decoder is avdec_aac on second file open.

If the audio has AC-3 codec but second file open uses avdec_aac then this is wrong and might be the cause of this problem. Can you share the link to the video in question?
Oh, get it wrong, my audio format of h264 video is acc, the codec format is correct.
https://user-images.githubusercontent.com/50469989/163997515-ff5a26e9-e4cb-4085-bfd8-b4470317358a.mp4
OK. I am able to reproduce this here with your video. Seems to be caused by setting volume (in this case restoring last volume) on startup for some reason for this particular video. A workaround like this fixes (avoids) this problem on my end:
diff --git a/src/controls.js b/src/controls.js
index b74b2f1..04f250b 100644
--- a/src/controls.js
+++ b/src/controls.js
@@ -374,7 +374,7 @@ class ClapperControls extends Gtk.Box
? settings.get_int('volume-value') / 100
: settings.get_double('volume-last');
- clapperWidget.player.volume = initialVolume;
+ //clapperWidget.player.volume = initialVolume;
clapperWidget.player.bind_property('mute', this.volumeButton, 'muted',
GObject.BindingFlags.DEFAULT
);
Definitely a GStreamer bug related to setting/changing initial volume. I can easily reproduce the same issue with gst-play-1.0 tool.
This works:
gst-play-1.0 "your_sample_video.mp4"
but this does not work:
gst-play-1.0 --volume=0 "your_sample_video.mp4"
@baiywt
If you can confirm those, please open this as an issue on GStreamer gitlab (https://gitlab.freedesktop.org/gstreamer/gstreamer) instead with same video attached. Should be fixed there instead of relaying on some workarounds inside the player.
Ok, thank you very much for your help.