Ullaakut / RTSPAllTheThings

Deprecated RTSP media server -- Use github.com/aler9/rtsp-simple-server instead.
Apache License 2.0
275 stars 72 forks source link

Q: Is it possible to loop a video? #70

Closed rodolfoap closed 5 years ago

rodolfoap commented 5 years ago

I need to loop small video files continuously. How can I do that (for what I've read, pipelines would not allow looping)? Thanks in advance...

Ullaakut commented 5 years ago

🤔 Looping videos forever is actually the default behavior when using a file input.

EDIT: I misunderstood this as a bug report and not a question, my bad. Just in case it's actually a bug report (if not, disregard these instructions):

Some RTSPATT streams have been running 24/7 since 2017 so I find it strange it would be an issue in the software, but just in case, could you add the following information to this ticket:

  • Command line you ran to launch RTSPATT
  • Logs of RTSPATT
  • Information on the video you are streaming (encoding, length, size, framerate and resolution if possible)
  • Re-run RTSPATT but add the following argument -e GST_DEBUG=3, paste those logs into a pastebin and add a link to the pastebin in the issue

If you do all that, I should be able to understand better what the issue is, and if it's a bug in RTSPATT, to reproduce it and fix it 🙏🏽

SuJiKiNen commented 5 years ago

I encounter this too.here's my info.sorry, it's a bit mess.

  1. docker run --rm -e GST_DEBUG=3 -e INPUT="/tmp/video.mp4" -e RTSP_PORT=18554 -e GST_PIPELINE="filesrc location=/tmp/video.mp4 ! qtdemux ! video/x-h264 ! rtph264pay pt=96 name=pay0" -v "$PWD/test.mp4:/tmp/video.mp4" -p 18554:18554 ullaakut/rtspatt

  2. 
    Server configuration:
    Address:    0.0.0.0
    Port:       18554
    Route:      /live.sdp
    Username:   
    Password:   
    Auth method:    basic
    Input:      /tmp/video.mp4
    Input type: file

Launching stream with the following pipeline: ( filesrc location=/tmp/video.mp4 ! qtdemux ! video/x-h264 ! rtph264pay pt=96 name=pay0 ) Stream ready at rtsp://0.0.0.0:18554/live.sdp ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory (rtspatt:1): GStreamer-CRITICAL **: 08:30:24.839: gst_util_set_object_arg: assertion 'G_IS_OBJECT (object)' failed

(rtspatt:1): CRITICAL : 08:30:24.839: gst_app_src_get_max_bytes: assertion 'GST_IS_APP_SRC (appsrc)' failed

(rtspatt:1): GLib-GObject-CRITICAL **: 08:30:24.839: g_object_set: assertion 'G_IS_OBJECT (object)' failed

(rtspatt:1): GLib-GObject-WARNING **: 08:30:24.839: invalid (NULL) pointer instance

(rtspatt:1): GLib-GObject-CRITICAL **: 08:30:24.839: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(rtspatt:1): GStreamer-CRITICAL **: 08:30:35.512: gst_util_set_object_arg: assertion 'G_IS_OBJECT (object)' failed

(rtspatt:1): CRITICAL : 08:30:35.512: gst_app_src_get_max_bytes: assertion 'GST_IS_APP_SRC (appsrc)' failed

(rtspatt:1): GLib-GObject-CRITICAL **: 08:30:35.512: g_object_set: assertion 'G_IS_OBJECT (object)' failed

(rtspatt:1): GLib-GObject-WARNING **: 08:30:35.512: invalid (NULL) pointer instance

(rtspatt:1): GLib-GObject-CRITICAL **: 08:30:35.512: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(rtspatt:1): GStreamer-CRITICAL **: 08:30:57.957: gst_util_set_object_arg: assertion 'G_IS_OBJECT (object)' failed

(rtspatt:1): CRITICAL : 08:30:57.957: gst_app_src_get_max_bytes: assertion 'GST_IS_APP_SRC (appsrc)' failed

(rtspatt:1): GLib-GObject-CRITICAL **: 08:30:57.957: g_object_set: assertion 'G_IS_OBJECT (object)' failed

(rtspatt:1): GLib-GObject-WARNING **: 08:30:57.957: invalid (NULL) pointer instance

(rtspatt:1): GLib-GObject-CRITICAL **: 08:30:57.957: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed


3. via mediainfo  

~~~General
Complete name                            : test.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (isom/mp42)
File size                                : 53.7 MiB
Duration                                 : 22s 415ms
Overall bit rate                         : 20.1 Mbps
Encoded date                             : UTC 2018-09-27 00:12:49
Tagged date                              : UTC 2018-09-27 00:12:49
©xyz                                     : +22.5575+113.9406/
com.android.version                      : 8.1.0

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Baseline@L4
Format settings, CABAC                   : No
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 22s 415ms
Bit rate                                 : 19.8 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 29.802 fps
Minimum frame rate                       : 5.445 fps
Maximum frame rate                       : 30.488 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.320
Stream size                              : 52.8 MiB (98%)
Title                                    : VideoHandle
Language                                 : English
Encoded date                             : UTC 2018-09-27 00:12:49
Tagged date                              : UTC 2018-09-27 00:12:49
Color range                              : Full
Color primaries                          : BT.601 PAL
Transfer characteristics                 : BT.601
Matrix coefficients                      : BT.601
mdhd_Duration                            : 22415

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 22s 400ms
Bit rate mode                            : Constant
Bit rate                                 : 192 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Frame rate                               : 46.875 fps (1024 spf)
Compression mode                         : Lossy
Stream size                              : 525 KiB (1%)
Title                                    : SoundHandle
Language                                 : English
Encoded date                             : UTC 2018-09-27 00:12:49
Tagged date                              : UTC 2018-09-27 00:12:49
  1. pastbin
lukeweston commented 5 years ago

@Ullaakut thanks for your great work!

Is it possible to not loop? You said looping was the default behaviour but I'm not sure where to override this.

The desired behaviour would be to play one iteration of the input video file and then terminate at the end of the video. Is there an option for this?

Ullaakut commented 5 years ago

Hi @lukeweston !

With the current pipeline, no there isn't. At the moment my only suggestion would be to use a custom pipeline to achieve this, but it requires knowledge of gstreamer unfortunately.

I'm currently planning on making a version 2.0 of rtspatt in go, so that might be one of the features I add in this next version. I'll make sure to update this issue if that's the case, in order to let you know about it.