Rafostar / clapper

Level up your video experience with a modern and user-friendly media player.
https://rafostar.github.io/clapper/
GNU General Public License v3.0
711 stars 34 forks source link

default playbin is playbin2 in 0.6.0 even with gstreamer 1.24+ #464

Open AndreySV opened 1 week ago

AndreySV commented 1 week ago

gstreamer 1.24 finally switched to playbin3 by default. But clapper sets old playbin by default. Maybe switch to playbin3 by default, when gstreamer 1.24+ is used?

In 0.5.2 there was an experimental option to enable playbin3. That was used for example to play videos on PinePhone with v4l2 decoders. With 0.6.0 and app rewrite this option was removed from tweaks and from GSettings schema. But it still needed to play videos on some devices. The only way to enable playbin3 is to use environment variables (GST_CLAPPER_USE_PLAYBIN3=1), it would be nice to have this setting back or switch to playbin3 by default, like it was done in gstreamer 1.24.

Rafostar commented 1 week ago

That was used for example to play videos on PinePhone with v4l2 decoders.

There is nothing preventing playbin2 from using v4l2 decoders. The bug in GStreamer that was making performance worse is reportedly fixed (although I do not have the hardware to test). In case of Flatpak workaround was always applied, so it was never an issue there.

The old env was kept and rewritten code supports both playbin2 and playbin3.

Nowadays Clapper provides public APIs that can be used from other applications. If a setting for this were to be added, it would be hard to eventually drop support of playbin2 when playbin3 will be better in every possible way. Also hard to change such setting default value. For this exact reason such option is no more, so we can switch to playbin3 in the future without breaking anything.

AndreySV commented 1 week ago

Without GST_CLAPPER_USE_PLAYBIN3=1 playback on original PinePhone (Sunxi A64) fails with following errors.

mobian@mobian:~$ GST_DEBUG="*:3" /usr/local/bin/clapper ~/Videos/Advanced\ Tracing\ Features\ to\ See\ What\ Your\ Application\ is\ Waiting\ On\ -\ Steven\ Rostedt\,\ Google\ \[AigYXBHCG64\].mp4 
0:00:01.058619243 11323 0xaaab02effda0 FIXME              glcontext gstglcontext.c:2038:gst_gl_wrapped_context_get_config:<glwrappedcontext0> wrapped context could not retrieve config. The application may be missing a call to gst_gl_context_fill_info() or the specific platform implemention is not implemented for retrieving the config from a wrapped OpenGL context.
0:00:02.170351859 11323 0xffff7c000e10 ERROR     v4l2codecs-h264dec gstv4l2codech264dec.c:453:gst_v4l2_codec_h264_dec_decide_allocation:<v4l2slh264dec0> DMABuf caps negotiated without the mandatory support of VideoMeta
0:00:02.170455568 11323 0xffff7c000e10 WARN            videodecoder gstvideodecoder.c:4392:gst_video_decoder_negotiate_pool:<v4l2slh264dec0> Subclass failed to decide allocation
0:00:02.170515402 11323 0xffff7c000e10 ERROR     v4l2codecs-h264dec gstv4l2codech264dec.c:941:gst_v4l2_codec_h264_dec_new_sequence:<v4l2slh264dec0> Failed to negotiate with downstream
0:00:02.170556861 11323 0xffff7c000e10 WARN             h264decoder gsth264decoder.c:2517:gst_h264_decoder_process_sps:<v4l2slh264dec0> subclass does not want accept new sequence
0:00:02.170594111 11323 0xffff7c000e10 WARN             h264decoder gsth264decoder.c:652:gst_h264_decoder_parse_sps:<v4l2slh264dec0> Failed to process SPS
0:00:02.170631361 11323 0xffff7c000e10 WARN             h264decoder gsth264decoder.c:721:gst_h264_decoder_parse_codec_data:<v4l2slh264dec0> Failed to parse SPS
0:00:02.170665570 11323 0xffff7c000e10 WARN             h264decoder gsth264decoder.c:1496:gst_h264_decoder_set_format:<v4l2slh264dec0> Failed to handle codec data
0:00:03.436361668 11323 0xffff7c000e10 FIXME                streams gststreams.c:252:gst_stream_set_stream_id:<86b05a721931776bed2d4d0dfa9990dd> Created random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:03.437915474 11323 0xffff7c000e10 FIXME                streams gststreams.c:252:gst_stream_set_stream_id:<1eb9a3487bc0b0f2a42a95c15974768b> Created random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:03.438105435 11323 0xffff7c000e10 FIXME                streams gststreams.c:252:gst_stream_set_stream_id:<6feead61ed91db75db17b0159c445395> Created random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:03.439596324 11323 0xffff7c0010d0 WARN      v4l2codecs-h264dec gstv4l2codech264dec.c:957:gst_v4l2_codec_h264_dec_new_sequence:<v4l2slh264dec0> GstVideoMeta support required, copying frames.
0:00:03.440270705 11323 0xffff7c0010d0 WARN             h264decoder gsth264decoder.c:1126:gst_h264_decoder_start_current_picture:<v4l2slh264dec0> subclass does not want to start picture
0:00:03.440375372 11323 0xffff7c0010d0 WARN             h264decoder gsth264decoder.c:1341:gst_h264_decoder_parse_slice:<v4l2slh264dec0> start picture failed
0:00:03.443586153 11323 0xffff7c000e10 WARN                 qtdemux qtdemux.c:7423:gst_qtdemux_loop:<qtdemux0> error: Internal data stream error.
0:00:03.443681862 11323 0xffff7c000e10 WARN                 qtdemux qtdemux.c:7423:gst_qtdemux_loop:<qtdemux0> error: streaming stopped, reason not-negotiated (-4)
0:00:03.444079324 11323 0xaaab02f1cb50 ERROR      clapperplaybinbus clapper-playbin-bus.c:210:_handle_error_msg:<clapperplayer0> Error: Internal data stream error.
0:00:03.444628579 11323 0xffff7c001390 WARN                GST_PADS gstpad.c:4392:gst_pad_peer_query:<uridecodebin0:src_1> could not send sticky events
0:00:03.471432997 11323 0xaaab02f1cb50 FIXME                streams gststreams.c:252:gst_stream_set_stream_id:<4723f4ca5f2055812ebfed6ca799140f> Created random stream-id, consider implementing a deterministic way of creating a stream-id

Following commands fail as well gst-launch-1.0 playbin uri=file:file.mp4 video-sink=waylandsink gst-launch-1.0 playbin uri=file:file.mp4 video-sink=glimagesink

but playbin works with fakesink. Do you think it should be reported to gstreamer?

Rafostar commented 1 week ago

Following commands fail as well gst-launch-1.0 playbin uri=file:file.mp4 video-sink=waylandsink gst-launch-1.0 playbin uri=file:file.mp4 video-sink=glimagesink

If this fails (Clapper is not involved) then it's GStreamer issue.

0:00:03.439596324 11323 0xffff7c0010d0 WARN v4l2codecs-h264dec gstv4l2codech264dec.c:957:gst_v4l2_codec_h264_dec_new_sequence: GstVideoMeta support required, copying frames.

This line is the main culprit that they wanted to get fixed.

AndreySV commented 1 week ago

It looks like the issue is already reported https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3456

The bug in GStreamer that was making performance worse is reportedly fixed (although I do not have the hardware to test).

Do you remember in which version it was fixed? 1.22 and 1.24.0 worked reasonably well only with playbin3.