how to save rtsp h.264 stream frame by frame

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

how to save rtsp h.264 stream frame by frame

venkata.subbarao
Hi All,

I have two questions which are related. Kindly help me.

1) openRTSP, a RTSP client from live555 has option to save rtsp stream as
frame by frame using -m option. How can I acheive this using gstreamer ?

I have created a pipeline in my C program as follows. In the callback of
appsink, I am trying to save frame by frame. But, I have no idea how to do
this.

rtspsrc location=rtsp://<rtsp url> ! queue ! rtph264depay ! h264parse !
appsink name=test sync=false

2) I tried to save the stream to a file using following command. The
recorded file can be played back. One thing I noticed is that this does not
have a start code 0x0 0x0 0x0 0x1 at the beginning of each frame like in
openRTSP saved file. Any reason why ?

gst-launch-1.0 rtspsrc location=<rtsp url> ! queue ! rtph264depay !
h264parse ! mpegtsmux ! filesink location=test.h264

Thanks,
Subbarao



--
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
|

Re: how to save rtsp h.264 stream frame by frame

Carl Karsten-2


On Fri, Oct 18, 2019 at 6:51 AM venkata.subbarao <[hidden email]> wrote:
Hi All,

I have two questions which are related. Kindly help me.

1) openRTSP, a RTSP client from live555 has option to save rtsp stream as
frame by frame using -m option. How can I acheive this using gstreamer ?

I have created a pipeline in my C program as follows. In the callback of
appsink, I am trying to save frame by frame. But, I have no idea how to do
this.

rtspsrc location=rtsp://<rtsp url> ! queue ! rtph264depay ! h264parse !
appsink name=test sync=false


gst-launch-1.0 videotestsrc num-buffers=30 ! pngenc ! multifilesink location="frame-%06d.png"

frame-000000.png
frame-000001.png
frame-000002.png
frame-000003.png
...

 

2) I tried to save the stream to a file using following command. The
recorded file can be played back. One thing I noticed is that this does not
have a start code 0x0 0x0 0x0 0x1 at the beginning of each frame like in
openRTSP saved file. Any reason why ?

gst-launch-1.0 rtspsrc location=<rtsp url> ! queue ! rtph264depay !
h264parse ! mpegtsmux ! filesink location=test.h264


I would start a 2nd thread for your 2nd question.
 
Thanks,
Subbarao



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


--
Carl K

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

Re: how to save rtsp h.264 stream frame by frame

venkata.subbarao
Thank you Carl. Finally, I found the following link which gave clues on how
to record frame by frame.

http://gstreamer-devel.966125.n4.nabble.com/Getting-Each-h264-Frame-td4664932.html

For the sake of any future searchers, pasted below the complete pipeline.

rtspsrc protocols=tcp location=<rtsp url> ! queue ! rtph264depay !
video/x-h264,alignment=au,stream-format=byte-stream ! h264parse ! appsink
name=test sync=false

Here is the gst-launch command which records the frames to the file without
AUD.

gst-launch-1.0 rtspsrc location=<rtsp url> ! rtph264depay ! h264parse !
video/x-h264,alignment=au,stream-format=byte-stream ! filesink
location=out.h264

With this both issues are resolved for me.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel