Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTSP error #31

Open
AndroidDesigner opened this issue Jun 12, 2024 · 1 comment
Open

RTSP error #31

AndroidDesigner opened this issue Jun 12, 2024 · 1 comment

Comments

@AndroidDesigner
Copy link

AndroidDesigner commented Jun 12, 2024

Hello @ardera
I want to stream an IP camera using rtsp in a Raspberrypi 4 (bullseye).
So, I used your sample code and wrote the below code in my flutter-pi project:

import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:flutterpi_gstreamer_video_player/flutterpi_gstreamer_video_player.dart';
import 'package:video_player/video_player.dart';

class CameraPage extends StatefulWidget {
  const CameraPage({super.key});
  
  @override
  State<CameraPage> createState() => _CameraPageState();
}

class _CameraPageState extends State<CameraPage> {

  late VideoPlayerController _controller;
  late ChewieController _chewieController;

  @override
  void initState() {
    super.initState();
    _controller = FlutterpiVideoPlayerController.withGstreamerPipeline(
      'rtspsrc location="rtsp://192.168.31.170:554" ! queue max-size-buffers=2 ! rtph264depay ! h264parse ! decodebin ! autovideosink sync=false appsink name="sink"'
    );
    _chewieController = ChewieController(
      videoPlayerController: _controller,
      autoInitialize: true,
      autoPlay: true,
      looping: true,
      isLive: true,
    );
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
    _chewieController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Chewie(controller: _chewieController);
  }

}

but it results in a blank screen (live video does not show) and shows the the below error:

plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.

Also, if I press refresh button of Chewie widget, it shows me the below error:

plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.
plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.
plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.
plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.
plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.
plugins/gstreamer_video_player/player.c: gstreamer error: code: 9, domain: gst-resource-error-quark, msg: Unhandled error (debug info: ../gst/rtsp/gstrtspsrc.c(6696): gst_rtspsrc_send (): /GstPipeline:pipeline4/GstRTSPSrc:rtspsrc4:
Session Not Found (454))
plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.
plugins/gstreamer_video_player/player.c: gstreamer error: code: 9, domain: gst-resource-error-quark, msg: Unhandled error (debug info: ../gst/rtsp/gstrtspsrc.c(6696): gst_rtspsrc_send (): /GstPipeline:pipeline5/GstRTSPSrc:rtspsrc5:
Session Not Found (454))
plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.
plugins/gstreamer_video_player/player.c: gstreamer error: code: 9, domain: gst-resource-error-quark, msg: Unhandled error (debug info: ../gst/rtsp/gstrtspsrc.c(6696): gst_rtspsrc_send (): /GstPipeline:pipeline6/GstRTSPSrc:rtspsrc6:
Session Not Found (454))
plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.
plugins/gstreamer_video_player/player.c: gstreamer error: code: 9, domain: gst-resource-error-quark, msg: Unhandled error (debug info: ../gst/rtsp/gstrtspsrc.c(6696): gst_rtspsrc_send (): /GstPipeline:pipeline7/GstRTSPSrc:rtspsrc7:
Session Not Found (454))

what is problem?

@ardera
Copy link
Owner

ardera commented Jun 13, 2024

    _controller = FlutterpiVideoPlayerController.withGstreamerPipeline(
      'rtspsrc location="rtsp://192.168.31.170:554" ! queue max-size-buffers=2 ! rtph264depay ! h264parse ! decodebin ! autovideosink sync=false appsink name="sink"'
    );

First, you need to remove the autovideosink. You don't want gstreamer to automatically select where to display the video, it will try to display it in a Desktop Window or something. You want flutter-pi to handle the video output.
Try this pipeline:

rtspsrc location="rtsp://192.168.31.170:554" ! queue max-size-buffers=2 ! rtph264depay ! h264parse ! decodebin !  appsink name="sink"

You can also try removing the rtph264depay and h264parse, IIRC decodebin will automatically decode those.

This here:

plugins/gstreamer_video_player/player.c: Couldn't find "src" element to configure additional HTTP headers.

is not an error message, it's just a warning. But I should probably make that more silent, seems to be confusing.

This here is the real error:

plugins/gstreamer_video_player/player.c: gstreamer error: code: 9, domain: gst-resource-error-quark, msg: Unhandled error (debug info: ../gst/rtsp/gstrtspsrc.c(6696): gst_rtspsrc_send (): /GstPipeline:pipeline7/GstRTSPSrc:rtspsrc7:
Session Not Found (454))

I have no idea about RTSP, so I don't really know what's going on here. Some gstreamer forum / IRC is probably the better place to ask. But with googling it seems like this can be caused by client/server state inconsistency, for example it could be server closed the connection or crashed, and client didn't notice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants