multifilesink not producing viewable files. Help!?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

multifilesink not producing viewable files. Help!?

Piper984
Hi:

I have a C application that receives an h264 stream and saves it to the HD.  Currently, this uses the filesink element, and it works fine. I can view the raw h264 data with VLC, and I can use MP4Box to convert the H264 stream into an MP4 file with the correct fps being set.  However, these incoming clips are very long and so I need my application to split the file into multiple segements, calling an event once each segments has been written to the HD so I can announce each segment to the database that manages all the incoming video segments.

From the docs, the multifilesink element seems to be what I need.  To test, I changed my app, replacing:

... filesink location=\"%s\"" ...

to:

... multifilesink post-messages=1 next-file=4 max-file-size=5000000 location=\"f-%%05d-%s\"" ...

This does create new files ~ every 5 megs named correctly, but I can't view the files with VLC like I can when I just used the filesink elemenet.  I also tried to convert the h264 to mp4 container via MP4Box, but MP4Box doesn't see the segmented .h264 files as valid.

I also tried adding the aggregate-gops property like this:

... multifilesink post-messages=1 aggregate-gops=1 next-file=4 max-file-size=5000000 location=\"f-%%05d-%s\"" ...

but no change in behavior.

Right now I am using GStreamer 1.4.3, so not able to use splitmuxsink.  Also, I don't think splitmuxsink has the ability to raise an event when each segments lands?  I am able to upgrade the GStreamer library for my app as needed, but I think I'm still mostly interested in multifilesink due to the post-messages feature. FYI: I have not tried hooking up the callback function yet.

Could someone with background with the multifilesink element provide some guidance as to what I may be doing wrong?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: multifilesink not producing viewable files. Help!?

Mandar Joshi
> Also, I don't think splitmuxsink has the ability to raise an event when each
> segments lands?

splitmuxsink has a format-location signal that is used to provide a
filename for the recording file.
You could use this callback
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: multifilesink not producing viewable files. Help!?

Arjen Veenhuizen
You should indeed switch to splitmuxsink. In addition, do not forget to add an h264parse element in your pipeline to make sure SPS/PPS information is properly inserted once in a while. If you switch to 1.10+, set config-interval=-1. If you are on a lower version, set config-interval=1.
Reply | Threaded
Open this post in threaded view
|

AW: multifilesink not producing viewable files. Help!?

Thornton, Keith
In reply to this post by Piper984
Splitmuxsink can signal each time a file is closed and again when a new file is opened. I would recommend 1.10 because quite a lot has been fixed in the recent past.

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:[hidden email]] Im Auftrag von Piper984
Gesendet: Mittwoch, 16. November 2016 19:30
An: [hidden email]
Betreff: multifilesink not producing viewable files. Help!?

Hi:

I have a C application that receives an h264 stream and saves it to the HD.
Currently, this uses the filesink element, and it works fine. I can view the raw h264 data with VLC, and I can use MP4Box to convert the H264 stream into an MP4 file with the correct fps being set.  However, these incoming clips are very long and so I need my application to split the file into multiple segements, calling an event once each segments has been written to the HD so I can announce each segment to the database that manages all the incoming video segments.

From the docs, the multifilesink element seems to be what I need.  To test, I changed my app, replacing:

... filesink location=\"%s\"" ...

to:

... multifilesink post-messages=1 next-file=4 max-file-size=5000000 location=\"f-%%05d-%s\"" ...

This does create new files ~ every 5 megs named correctly, but I can't view the files with VLC like I can when I just used the filesink elemenet.  I also tried to convert the h264 to mp4 container via MP4Box, but MP4Box doesn't see the segmented .h264 files as valid.

I also tried adding the aggregate-gops property like this:

... multifilesink post-messages=1 aggregate-gops=1 next-file=4
max-file-size=5000000 location=\"f-%%05d-%s\"" ...

but no change in behavior.

Right now I am using GStreamer 1.4.3, so not able to use splitmuxsink.
Also, I don't think splitmuxsink has the ability to raise an event when each segments lands?  I am able to upgrade the GStreamer library for my app as needed, but I think I'm still mostly interested in multifilesink due to the post-messages feature. FYI: I have not tried hooking up the callback function yet.

Could someone with background with the multifilesink element provide some guidance as to what I may be doing wrong?

Thanks!




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/multifilesink-not-producing-viewable-files-Help-tp4680722.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: multifilesink not producing viewable files. Help!?

Piper984
Hello folks,

Thanks for the update regarding multifilesink vs splitmuxsink.  I just downloaded and built gstreamer 1.10.1 and all the plugins + libav.  Then I updated my app to use the splitmuxsink.  However, I get the following runtime warning:

** (recv:24555): WARNING **: Failed to link muxer and sink- splitmuxsink will not work

and the app isn't able to display any video or save anything to disk.  I did make sure to adjust the h264parse element as followings:

h264parse config-interval=-1

Here is the pipeline which generates the warning:

rtph264depay name=h264depay !   avdec_h264 ! videocrop name=crop ! tee name=t t. ! queue ! autovideosink t. ! queue ! timeoverlay ! x264enc bitrate=1200 tune=zerolatency ! video/x-h264,profile=baseline ! h264parse config-interval=-1 ! splitmuxsink location="f-%05d-output3.h264" max-size-time=10000000000 max-size-bytes=1000000

Any chance someone has some ideas as to my issue?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: AW: multifilesink not producing viewable files. Help!?

Mandar Joshi
> rtph264depay name=h264depay !   avdec_h264 ! videocrop name=crop ! tee
> name=t t. ! queue ! autovideosink t. ! queue ! timeoverlay ! x264enc
> bitrate=1200 tune=zerolatency ! video/x-h264,profile=baseline ! h264parse
> config-interval=-1 ! splitmuxsink location="f-%05d-output3.h264"
> max-size-time=10000000000 max-size-bytes=1000000
>
Try passing the following options to x264enc:
x264enc tune=zerolatency pass=qual quantizer=27 subme=4 threads=2
bitrate=1024 key-int-max=4


The pipeline I successfully tested was
GST_DEBUG=3 gst-launch-1.0 -v -e v4l2src device=/dev/video0 !
video/x-raw,width=640,height=480 ! tee name=t t. ! queue ! xvimagesink
sync=false t. ! queue ! timeoverlay ! x264enc tune=zerolatency
pass=qual quantizer=27 subme=4 threads=2 bitrate=1024 key-int-max=4 !
video/x-h264,profile=baseline ! h264parse config-interval=1 !
splitmuxsink location="f-%05d-output3.h264" max-size-time=10000000000
max-size-bytes=1000000

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: multifilesink not producing viewable files. Help!?

Piper984
Hi Mandar and all,

I have made some progress with my need to use the splitmuxsink plugin, but I am still having an issue getting this to work with rtp.  I am sure it is my lack of understand on h264 encoding.  Perhaps someone could take a look at what I'm doing and offer some advice?

I have the following pipeline with splitmuxsink working:

gst-launch-1.0 -v -e v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720 ! tee name=t t. ! queue ! fpsdisplaysink sync=false t. ! queue ! timeoverlay ! x264enc tune=zerolatency pass=qual quantizer=27 subme=4 threads=2 bitrate=1024 key-int-max=4 ! video/x-h264,profile=baseline ! h264parse config-interval=1 ! splitmuxsink location="f-%05d-output3.h264" max-size-time=10000000000 max-size-bytes=1000000

which take my laptop's camera as input and saves the output the disk in chunks.  This works great.

However, here is the pipeline I'd like to splitmux the video to disk in chunks:

(bash script)
#!/bin/sh
VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
VIDEO_DEC="identity ! rtph264depay ! avdec_h264"

VIDEO_SINK="fpsdisplaysink sync=false text-overlay=false"
DEST=192.168.200.208

LATENCY=200

gst-launch-1.0 -v rtpbin name=rtpbin latency=$LATENCY do-retransmission=0           \
    udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0                      \
      rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK

(end bash script)

I have tried to replace the VIDEO_SINK elements to something like:

VIDEO_SINK="h264parse ! splitmuxsink max-size-bytes=5000000 location=\"f-%05d-output.h264\""

but I get error message that avec_h264 can't link to h264parse.  I confess I am a bit lost as to how/if/when I need to invoke the x264enc element.

If anyone could help point me to the correct elements/syntax that would let me make use of the splitmux element to save gapless video segments to disk from my rtp stream, I would really appreciate the help!

Regards!



Mandar Joshi wrote
> rtph264depay name=h264depay !   avdec_h264 ! videocrop name=crop ! tee
> name=t t. ! queue ! autovideosink t. ! queue ! timeoverlay ! x264enc
> bitrate=1200 tune=zerolatency ! video/x-h264,profile=baseline ! h264parse
> config-interval=-1 ! splitmuxsink location="f-%05d-output3.h264"
> max-size-time=10000000000 max-size-bytes=1000000
>
Try passing the following options to x264enc:
x264enc tune=zerolatency pass=qual quantizer=27 subme=4 threads=2
bitrate=1024 key-int-max=4


The pipeline I successfully tested was
GST_DEBUG=3 gst-launch-1.0 -v -e v4l2src device=/dev/video0 !
video/x-raw,width=640,height=480 ! tee name=t t. ! queue ! xvimagesink
sync=false t. ! queue ! timeoverlay ! x264enc tune=zerolatency
pass=qual quantizer=27 subme=4 threads=2 bitrate=1024 key-int-max=4 !
video/x-h264,profile=baseline ! h264parse config-interval=1 !
splitmuxsink location="f-%05d-output3.h264" max-size-time=10000000000
max-size-bytes=1000000

Regards
Mandar Joshi
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: multifilesink not producing viewable files. Help!?

Mandar Joshi
> VIDEO_DEC="identity ! rtph264depay ! avdec_h264"
>
Change VIDEO_DEC to
VIDEO_DEC="identity ! rtph264depay"
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: multifilesink not producing viewable files. Help!?

Piper984
Thanks for the advice Mandar.  I tried to remove the avdev_h264 element, and gst-launch made it further into the process of starting up, but error-ed out with an error note of "Internal data stream error."  Here is the console output w/ --gst-debug=3 -v option set on gst-launch-1.0:

<console>
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstFileSink:sink: location = f-00000-output.h264
/GstPipeline:pipeline0/GstUDPSrc:udpsrc0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin.GstGhostPad:recv_rtp_sink_0.GstProxyPad:proxypad0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin/GstRtpSession:rtpsession0.GstPad:recv_rtp_src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin/GstRtpSession:rtpsession0.GstPad:recv_rtp_sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin.GstGhostPad:recv_rtp_sink_0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.089556919 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
/GstPipeline:pipeline0/GstRtpBin:rtpbin/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, ssrc=(uint)2897502521
/GstPipeline:pipeline0/GstRtpBin:rtpbin/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, ssrc=(uint)2897502521
/GstPipeline:pipeline0/GstRtpBin:rtpbin/GstRtpPtDemux:rtpptdemux0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, ssrc=(uint)2897502521
0:00:00.093163085 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.124974540 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.125060127 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.125835341 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.125999714 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.126902567 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.127055316 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.127367101 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.127546602 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.127719803 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.127880400 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.128184867 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.128330914 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.128505762 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.128802252 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.128959557 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.129107372 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.129404160 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.129609073 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.129656434 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.130093140 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.130147368 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.130729256 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.154854467 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.155310417 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.156092112 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.156212936 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.186683613 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.190147249 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.190206049 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.219343497 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.219470513 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.220124101 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.253296761 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.254049710 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.254180047 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
/GstPipeline:pipeline0/GstIdentity:identity0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, ssrc=(uint)2897502521, payload=(int)96
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, ssrc=(uint)2897502521, payload=(int)96
/GstPipeline:pipeline0/GstIdentity:identity0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, ssrc=(uint)2897502521, payload=(int)96
0:00:00.290120079 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.290443919 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.290503558 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
/GstPipeline:pipeline0/GstRtpBin:rtpbin.GstGhostPad:recv_rtp_src_0_2897502521_96.GstProxyPad:proxypad2: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, ssrc=(uint)2897502521, payload=(int)96
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)01640028ffe1000e27640028ac2b40501ed00f1226a001000528ee025cb0, level=(string)4, profile=(string)high
0:00:00.323381864 31384       0xfe19e0 WARN               rtpsource rtpsource.c:983:calculate_jitter: cannot get clock-rate for pt 96
0:00:00.323432119 31384       0xfe19e0 WARN                 basesrc gstbasesrc.c:2950:gst_base_src_loop:<udpsrc0> error: Internal data stream error.
0:00:00.323444645 31384       0xfe19e0 WARN                 basesrc gstbasesrc.c:2950:gst_base_src_loop:<udpsrc0> error: streaming stopped, reason not-negotiated (-4)
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(2950): gst_base_src_loop (): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.264163874
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
</console>

Here is a snip of the sending application's pipeline (C program, Raspbian), in case the helps us figure out what I'm doing wrong:

<code_snip>
    str = g_strdup_printf (
        "rpicamsrc vflip=1 hflip=1 bitrate=%i\n"
        "   ! video/x-h264,width=%i,height=%i,framerate=" FRAMERATE ",profile=" PROFILE
        "   ! h264parse ! rtph264pay config-interval=1 name=h264pay",
        BITRATE, WIDTH, HEIGHT);  
</code_snip>

Thanks for looking at this with me!



Mandar Joshi wrote
> VIDEO_DEC="identity ! rtph264depay ! avdec_h264"
>
Change VIDEO_DEC to
VIDEO_DEC="identity ! rtph264depay"
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel