LINUX.ORG.RU

Как можно использовать встроенный в GNOME Screencast для стримов?

 , , , ,


0

1

Хочу вещать часть своего экрана, нашёл для этого подходящий метод:

    <!--
        ScreencastArea:
        @x: the X coordinate of the area to capture
        @y: the Y coordinate of the area to capture
        @width: the width of the area to capture
        @height: the height of the area to capture
        @file_template: the template for the filename to use
        @options: a dictionary of optional parameters
        @success: whether the screencast was started successfully
        @filename_used: the file where the screencast is being saved
        Records a screencast of the passed in area and saves it
        (by default) as webm video under a filename derived from
        @file_template. The template is either a relative or absolute
        filename which may contain some escape sequences - %d and %t
        will be replaced by the start date and time of the recording.
        If a relative name is used, the screencast will be saved in the
        $XDG_VIDEOS_DIR if it exists, or the home directory otherwise.
        The actual filename of the saved video is returned in @filename_used.
        The set of optional parameters in @options currently consists of:
            'draw-cursor'(b): whether the cursor should be included in the
                              recording (true)
            'framerate'(i): the number of frames per second that should be
                            recorded if possible (30)
            'pipeline'(s): the GStreamer pipeline used to encode recordings
                           in gst-launch format; if not specified, the
                           recorder will produce vp8 (webm) video (unset)
    -->
    <method name="ScreencastArea">
      <arg type="i" direction="in" name="x"/>
      <arg type="i" direction="in" name="y"/>
      <arg type="i" direction="in" name="width"/>
      <arg type="i" direction="in" name="height"/>
      <arg type="s" direction="in" name="file_template"/>
      <arg type="a{sv}" direction="in" name="options"/>
      <arg type="b" direction="out" name="success"/>
      <arg type="s" direction="out" name="filename_used"/>
</method>
Каким должен быть pipeline для GStreamer, чтобы передавать видео по сети? Какой использовать сервер?

★★★★★

Строго говоря, из документации не очевидно, что выход вообще можно передавать куда-либо кроме файла. Но, насколько могу видеть (1, 2), в аргументе pipeline действительно допускается использование пайплайнов с своим собственным sink. Выходной файл тогда не открывается и аргумент file_template не используется, в filename_used возвращается NULL (не знаю, как он представляется со стороны D-Bus).

tl;dr: попробуй посмотреть здесь: http://www.einarsundgren.se/gstreamer-basic-real-time-streaming-tutorial/

Пример оттуда, минус source:

videoconvert ! videoscale ! video/x-raw,format=I420,width=800,height=600,framerate=25/1 ! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5000

intelfx ★★★★★
()
Последнее исправление: intelfx (всего исправлений: 2)
Ответ на: комментарий от intelfx

Интересно. Только воспользоваться скринкастилкой у меня не получилось. Пробовал так:

$ gdbus call --session --dest org.gnome.Shell.Screencast --object-path /org/gnome/Shell/Screencast --method org.gnome.Shell.Screencast.ScreencastArea 0 56 1366 712 "test.webm" {}
(true, '/home/user/Видео/test.webm')
И так:
$ gdbus call --session --dest org.gnome.Shell.Screencast --object-path /org/gnome/Shell/Screencast --method org.gnome.Shell.Screencast.Screencast "test.webm" {}
(true, '/home/user/Видео/test.webm')
Файл действительно создаётся, но он не содержит видео, только заголовок. И пайплайн в качестве параметра я не осилил.

CYB3R ★★★★★
() автор топика
Ответ на: комментарий от intelfx

Сейчас попробовал указать пайплайн так:

$ gdbus call --session --dest org.gnome.Shell.Screencast --object-path /org/gnome/Shell/Screencast --method org.gnome.Shell.Screencast.ScreencastArea 0 56 1366 712 "" "{'pipeline': <'x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=5000'>}"
(true, '')
На принимающей стороне получил:
$ gst-launch-1.0 -v udpsrc port=5000 ! rtpmp2tdepay ! decodebin ! autovideosink
Установка конвейера в состояние PAUSED…
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Конвейер работает и не требует состояния PREROLL…
Установка конвейера в состояние PLAYING…
New clock: GstSystemClock
ОШИБКА: из элемента /GstPipeline:pipeline0/GstRtpMP2TDepay:rtpmp2tdepay0: No RTP format was negotiated.
Дополнительная отладочная информация:
gstrtpbasedepayload.c(458): gst_rtp_base_depayload_handle_buffer (): /GstPipeline:pipeline0/GstRtpMP2TDepay:rtpmp2tdepay0:
Input buffers need to have RTP caps set on them. This is usually achieved by setting the 'caps' property of the upstream source element (often udpsrc or appsrc), or by putting a capsfilter element before the depayloader and setting the 'caps' property on that. Also see http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtp/README
Execution ended after 0:00:13.156581718
Установка конвейера в состояние PAUSED…
Установка конвейера в состояние READY…
Установка конвейера в состояние NULL…
Освобождение конвейера…
То есть всё в принципе правильно запускается, только само видео не пишется почему-то.

CYB3R ★★★★★
() автор топика
Последнее исправление: CYB3R (всего исправлений: 1)
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.