Dump 10 seconds of video at once.

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

Dump 10 seconds of video at once.

Toshick
Hello all.

I need to make program which displays online video from rtsp and then, by a command, it dumps 10 seconds of video to the disk (creates playable video file). 

I've created working pipeline looking like:
rtspsrc location=<video_uri> ! rtph264depay ! queue min-threshold-time=11000000000 name=n ! avdec_h264 ! autovideosink

It has 10 seconds of buffer and working fine.

Now I need to dump all content of the queue to the disk at once.

I've tried different methods:
queue2, shmsink, appsink and etc.
But all of them has some disadvantages:
    queue2 - creates temp file on disk during playout. But when I try to 'cat' it I'm not getting playable video file. I've tried to pass it as filesrc - but this pipeline refuses to start. As I understand queue does not store video directly - it has its metadata aside.
    shmsink - socket is created, I've tried to shmcat it - but it doesn't work. 
    appsink - provides video stream frame by frame, but no whole buffer at once. 

So is there is any way to make it with standard GST tools? Or only the way it to create appsink callback and save frame by frame to gst.buffer and then, when it is needed, dump this buffer to disk with appsrc->filesink?

Thank you in advance.
Best regards,
Anton.

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

Re: Dump 10 seconds of video at once.

Vinod Kesti
You can tee the h264 stream and pass to both display and recording branch.

rtspsrc location=<video_uri> ! rtph264depay ! tee name=t\
t.! queue min-threshold-time=11000000000 name=q1 ! avdec_h264 !
autovideosink \
t.! queue min-threshold-time=11000000000 name=q2 ! h264parse
config-interval=1 ! splitmuxsink max-size-time=10000000000


*Note: Adjust queue size if your pipeline is hanging.*




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

AW: Dump 10 seconds of video at once.

Thornton, Keith
In reply to this post by Toshick

Hi, if you want to dump h264 to an mp4 file for instance try

 

Tee --- queue avdec_h264  --- autovideosink

         |--queue (with min-threshold == 11 secs) – h264parse – mp4mux – filesink.

If you then set min-threshold to 1 it will empty the queue

 

Von: gstreamer-devel <[hidden email]> Im Auftrag von Anton Pryima
Gesendet: Mittwoch, 19. Februar 2020 10:16
An: Discussion of the development of and with GStreamer <[hidden email]>
Betreff: Dump 10 seconds of video at once.

 

Hello all.

 

I need to make program which displays online video from rtsp and then, by a command, it dumps 10 seconds of video to the disk (creates playable video file). 

 

I've created working pipeline looking like:

rtspsrc location=<video_uri> ! rtph264depay ! queue min-threshold-time=11000000000 name=n ! avdec_h264 ! autovideosink

 

It has 10 seconds of buffer and working fine.

 

Now I need to dump all content of the queue to the disk at once.

 

I've tried different methods:

queue2, shmsink, appsink and etc.

But all of them has some disadvantages:

    queue2 - creates temp file on disk during playout. But when I try to 'cat' it I'm not getting playable video file. I've tried to pass it as filesrc - but this pipeline refuses to start. As I understand queue does not store video directly - it has its metadata aside.

    shmsink - socket is created, I've tried to shmcat it - but it doesn't work. 

    appsink - provides video stream frame by frame, but no whole buffer at once. 

 

So is there is any way to make it with standard GST tools? Or only the way it to create appsink callback and save frame by frame to gst.buffer and then, when it is needed, dump this buffer to disk with appsrc->filesink?

 

Thank you in advance.

Best regards,

Anton.


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

Re: Dump 10 seconds of video at once.

Toshick
Hello, 

I've tried, but there are couple disadvantages:
1. I'm not able to stop part of the pipe which writing to the file.
2. Setting min-threshold-time to 1 dynamically doesn't have any effect.

Finally, I'm trying to achieve that using shm:
pipeline_string = "rtspsrc location=<video_uri> " \
                  "! rtph264depay " \
                  "! tee name=t " \
                  "t. " \
                  "! queue" \
                  "! avdec_h264 " \
                  "! autovideosink " \
                  "t. " \
                  "! queue min-threshold-time=11000000000 name=cam1 " \
                  "! h264parse" \
                  "! shmsink socket-path=/tmp/src wait-for-connection=false shm-size=10000000"

And,
pipeline2_string = "shmsrc socket-path=/tmp/src"  \
                   "! queue" \
                   "! filesink location=vid.avi"

At other end.

But in such case - pipeline doesn't want to preroll error!

Any other suggestions?

Best regards,
Anton


On Wed, Feb 19, 2020, 12:40 Thornton, Keith <[hidden email]> wrote:

Hi, if you want to dump h264 to an mp4 file for instance try

 

Tee --- queue avdec_h264  --- autovideosink

         |--queue (with min-threshold == 11 secs) – h264parse – mp4mux – filesink.

If you then set min-threshold to 1 it will empty the queue

 

Von: gstreamer-devel <[hidden email]> Im Auftrag von Anton Pryima
Gesendet: Mittwoch, 19. Februar 2020 10:16
An: Discussion of the development of and with GStreamer <[hidden email]>
Betreff: Dump 10 seconds of video at once.

 

Hello all.

 

I need to make program which displays online video from rtsp and then, by a command, it dumps 10 seconds of video to the disk (creates playable video file). 

 

I've created working pipeline looking like:

rtspsrc location=<video_uri> ! rtph264depay ! queue min-threshold-time=11000000000 name=n ! avdec_h264 ! autovideosink

 

It has 10 seconds of buffer and working fine.

 

Now I need to dump all content of the queue to the disk at once.

 

I've tried different methods:

queue2, shmsink, appsink and etc.

But all of them has some disadvantages:

    queue2 - creates temp file on disk during playout. But when I try to 'cat' it I'm not getting playable video file. I've tried to pass it as filesrc - but this pipeline refuses to start. As I understand queue does not store video directly - it has its metadata aside.

    shmsink - socket is created, I've tried to shmcat it - but it doesn't work. 

    appsink - provides video stream frame by frame, but no whole buffer at once. 

 

So is there is any way to make it with standard GST tools? Or only the way it to create appsink callback and save frame by frame to gst.buffer and then, when it is needed, dump this buffer to disk with appsrc->filesink?

 

Thank you in advance.

Best regards,

Anton.

_______________________________________________
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: Dump 10 seconds of video at once.

Stephenwei
 "! shmsink socket-path=/tmp/src wait-for-connection=false shm-size=10000000"

you can change the recording element, likes a multifdsink as well as create
another gstreamer pipeline to start/stop it.






-----
GStreamer is a convenient multimedia platform, I like it.
Develop the NVR system on ARM/x86(c/python)
Use python to generate NVR is crazy, of course works fine.

--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
GStreamer is a convenient multimedia platform, I like it.
Develop the NVR system on ARM/x86(c/python)
Use python to generate NVR is crazy, of course works fine.