Video Recording issue in Gstreamer

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

Video Recording issue in Gstreamer

Aditya Oza
hello sir,

Greetings!!

Consider me a beginner in Gstreamer. My Objective is I am try to record a video at 1080p resolution at 30 fps in H264 Format  from my Raspberry pi camera using Gstreamer Following pipeline: 

 `` gst-launch-1.0 -v v4l2src device=/dev/video0 ! capsfilter caps="video/x-raw,width=1920,height=1080,framerate=30/1" ! videoflip method=clockwise ! videoflip method=clockwise ! videoconvert ! videorate ! x264enc! avimux ! filesink location=test_video.h264 ``

After I Run above pipeline,
I will not get any kind of error but recorded video shows 1080p and 30fps but frames are dropping heavily.
Please suggest me This is Right pipelining or not ? OR
Any missing element in this pipeline ?


Thanks,
Aditya Oza
Firmware Developer at Teksun Microsys Pvt Ltd, Ahmedabad

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

Re: Video Recording issue in Gstreamer

David Ing
Perhaps use just one videoflip with method=rotate-180.

If frames are still dropping then use --gst-debug flag to set log levels which could provide clues about why frames are dropping.

On Thu, May 2, 2019, 5:06 AM Aditya Oza <[hidden email]> wrote:
hello sir,

Greetings!!

Consider me a beginner in Gstreamer. My Objective is I am try to record a video at 1080p resolution at 30 fps in H264 Format  from my Raspberry pi camera using Gstreamer Following pipeline: 

 `` gst-launch-1.0 -v v4l2src device=/dev/video0 ! capsfilter caps="video/x-raw,width=1920,height=1080,framerate=30/1" ! videoflip method=clockwise ! videoflip method=clockwise ! videoconvert ! videorate ! x264enc! avimux ! filesink location=test_video.h264 ``

After I Run above pipeline,
I will not get any kind of error but recorded video shows 1080p and 30fps but frames are dropping heavily.
Please suggest me This is Right pipelining or not ? OR
Any missing element in this pipeline ?


Thanks,
Aditya Oza
Firmware Developer at Teksun Microsys Pvt Ltd, Ahmedabad
_______________________________________________
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: Video Recording issue in Gstreamer

Aditya Oza
This post was updated on .
Thank you for Rply,

As you mention above first, I use  video-flip rotation=180 command in place
of video-flipmethod=clockwise and get perfect result as same as previous.

 I use following pipeline:

 gst-launch-1.0 -v  v4l2src device=/dev/video0 ! capsfilter
caps="video/x-raw, width=1920,height=1080,framerate=30/1" ! videoflip
method=rotate-180 ! gst-debug ! videoconvert ! videorate ! x264enc! avimux
! filesink location=test_video.h264

now my doubt is, where i use --gst debug flag in my pipeline?  
   



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

Re: Video Recording issue in Gstreamer

David Ing
In reply to this post by David Ing
Sorry I meant --gst-debug-level=2 would show you warning (level=2) and error (level=1) log messages.  If you set --gst-debug-level=3 then you would also see info (level=3) log messages.

Alternatively you can set the GST_DEBUG environment variable in exactly the same way.  To learn more about setting this variable:

You can also set the debug level on individual log categories.  For a list of those categories:

gst-launch-1.0 --gst-debug-help

On Thu, May 2, 2019 at 7:45 AM Aditya Oza <[hidden email]> wrote:
Thank you for reply,

As you mention above first, I use *video-flip rotation=180* command in place
of *video-flipmethod=clockwise* and get perfect result as same as previous.

 I use following pipeline:

 gst-launch-1.0 -v  v4l2src device=/dev/video0 ! capsfilter
caps="video/x-raw, width=1920,height=1080,framerate=30/1" !* videoflip
method=rotate-180* ! gst-debug ! videoconvert ! videorate ! x264enc! avimux
! filesink location=test_video.h264

now my doubt is, where i use --gst debug flag in my pipeline? 




--
Sent from: http://gstreamer-devel.966125.n4.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: Video Recording issue in Gstreamer

Michael Gruner
Also, in a Raspberry Pi you may want to replace the x264enc by the HW accelerated one omxh264enc

Michael

On May 2, 2019, at 8:57 AM, David Ing <[hidden email]> wrote:

Sorry I meant --gst-debug-level=2 would show you warning (level=2) and error (level=1) log messages.  If you set --gst-debug-level=3 then you would also see info (level=3) log messages.

Alternatively you can set the GST_DEBUG environment variable in exactly the same way.  To learn more about setting this variable:

You can also set the debug level on individual log categories.  For a list of those categories:

gst-launch-1.0 --gst-debug-help

On Thu, May 2, 2019 at 7:45 AM Aditya Oza <[hidden email]> wrote:
Thank you for reply,

As you mention above first, I use *video-flip rotation=180* command in place
of *video-flipmethod=clockwise* and get perfect result as same as previous.

 I use following pipeline:

 gst-launch-1.0 -v  v4l2src device=/dev/video0 ! capsfilter
caps="video/x-raw, width=1920,height=1080,framerate=30/1" !* videoflip
method=rotate-180* ! gst-debug ! videoconvert ! videorate ! x264enc! avimux
! filesink location=test_video.h264

now my doubt is, where i use --gst debug flag in my pipeline? 




--
Sent from: http://gstreamer-devel.966125.n4.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

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

Re: Video Recording issue in Gstreamer

Aditya Oza
thank you, its working..
 I replace x264enc with omxh264enc.

And i also add --gst debug-level=4 in my pipeline...so my pipeline is...

 gst-launch-1.0  --gst-debug-level=3 -v  v4l2src device=/dev/video0 !
capsfilter caps="video/x-raw, width=1920,height=1080,framerate=30/1" !
videoflip method=rotate-180 ! videoconvert ! videorate ! omxh264enc ! avimux
! filesink location = test_video.h264


After i run this command, still i face frame missing problem in recording
file.

here i attached image file of running command...

If any kind of mistake in this pipeline, please let me know and suggest me a
Right command.

<http://gstreamer-devel.966125.n4.nabble.com/file/t378874/23.png>



--
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: Video Recording issue in Gstreamer

Aditya Oza
This post was updated on .
In reply to this post by Michael Gruner
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

AW: Video Recording issue in Gstreamer

BGraaf
Try to use queue-element before and after the encoder. It's a hard job to
encode :-)

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:[hidden email]]
Im Auftrag von Aditya Oza
Gesendet: Donnerstag, 2. Mai 2019 19:09
An: [hidden email]
Betreff: Re: Video Recording issue in Gstreamer

thank you, its working..
 I replace x264enc with omxh264enc.

And i also add --gst debug-level=4 in my pipeline...so my pipeline is...

 gst-launch-1.0  --gst-debug-level=3 -v  v4l2src device=/dev/video0 !
capsfilter caps="video/x-raw, width=1920,height=1080,framerate=30/1" !
videoflip method=rotate-180 ! videoconvert ! videorate ! omxh264enc ! avimux
! filesink location = test_video.h264


After i run this command, still i face frame missing problem in recording
file.

here i attached image file of running command...

If any kind of mistake in this pipeline, please let me know and suggest me a

Right command.

<http://gstreamer-devel.966125.n4.nabble.com/file/t378874/23.png>



--
Sent from: http://gstreamer-devel.966125.n4.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: Video Recording issue in Gstreamer

Wolfgang Grandegger
In reply to this post by Aditya Oza
Hello,

any reason why you send the message always twice?

Watch the CPU usage of your system, e.g. with htop. Likely your system
is not powerful enough to handle the stream at that rather high
resolution and rate. Can't tell if you can do even more in hardware.

Wolfgang


Am 02.05.19 um 19:04 schrieb Aditya Oza:

> thank you, its working..
>  I replace x264enc with omxh264enc.
>
> And i also add --gst debug-level=4 in my pipeline...so my pipeline is...
>
>  gst-launch-1.0  --gst-debug-level=3 -v  v4l2src device=/dev/video0 !
> capsfilter caps="video/x-raw, width=1920,height=1080,framerate=30/1" !
> videoflip method=rotate-180 ! videoconvert ! videorate ! omxh264enc ! avimux
> ! filesink location = test_video.h264
>
>
> After i run this command, still i face frame missing problem in recording
> file.
>
> here i attached image file of running command...
>
> If any kind of mistake in this pipeline, please let me know and suggest me a
> Right command.
>
> <http://gstreamer-devel.966125.n4.nabble.com/file/t378874/23.png>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.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: Video Recording issue in Gstreamer

Aditya Oza
In reply to this post by BGraaf
Thank you BGraaf,

as you mention i use queue element before and after encoder and its work
better compare to previous pipeline.

 gst-launch-1.0  --gst-debug-level=3 -v  v4l2src device=/dev/video0 !
capsfilter caps="video/x-raw, width=1920,height=1080,framerate=30/1" !
videoflip method=rotate-180 ! videoconvert ! videorate ! queue ! omxh264enc
! queue ! avimux ! filesink location = test_video.h264

PROBLEM:

After running  this pipeline, I  found that it records whole video, but
still some frame are missing in it.





--
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: Video Recording issue in Gstreamer

Aditya Oza
In reply to this post by Wolfgang Grandegger
Thank you Wolfgang Grandegger,

I apologize for replying twice.

CPU usage  is 33% while recording  the video(1080p).


 



--
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: Video Recording issue in Gstreamer

Aditya Oza
In reply to this post by Wolfgang Grandegger
Reply | Threaded
Open this post in threaded view
|

Re: Video Recording issue in Gstreamer

Nicolas Dufresne-5
In reply to this post by Aditya Oza
Le vendredi 03 mai 2019 à 02:10 -0500, Aditya Oza a écrit :
> Thank you Wolfgang Grandegger,
>
> I apologize for replying twice.
>
> CPU usage  is 33% while recording  the video(1080p).

That seems quite decent. videoflip will do a copy (to flip), just that
must be using quite some CPU.

>
>
>  
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.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: Video Recording issue in Gstreamer

Nicolas Dufresne-5
In reply to this post by Aditya Oza
Le vendredi 03 mai 2019 à 01:54 -0500, Aditya Oza a écrit :

> Thank you BGraaf,
>
> as you mention i use queue element before and after encoder and its work
> better compare to previous pipeline.
>
>  gst-launch-1.0  --gst-debug-level=3 -v  v4l2src device=/dev/video0 !
> capsfilter caps="video/x-raw, width=1920,height=1080,framerate=30/1" !
> videoflip method=rotate-180 ! videoconvert ! videorate ! queue ! omxh264enc
> ! queue ! avimux ! filesink location = test_video.h264
>
> PROBLEM:
>
> After running  this pipeline, I  found that it records whole video, but
> still some frame are missing in it.

Move the queue between v4l2src and videoflip. v4l2src is the real-time
thing in your pipeline, so it's not ideal if it shares a thread with
the high CPU videoflip element. Be aware the videoreate can drop frames
too.

my two cents,
Nicolas

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

Re: AW: Video Recording issue in Gstreamer

Aditya Oza
Thank you Nicolas Dufresne-5.

Thank you for your support,

I move the queue element between v4l2src and videoflip so  the following
pipeline is:

 gst-launch-1.0  --gst-debug-level=3 -v  v4l2src device=/dev/video0 !
 capsfilter caps="video/x-raw, width=1920,height=1080,framerate=30/1" !
 queue ! videoflip method=rotate-180 ! videoconvert ! videorate !
omxh264enc
 ! queue ! avimux ! filesink location = test_video.h264

After run this command still frame missing issue is there.

and I also check CPU usage when recording video file running that is  28%.
Its reduce to 5% compare to previous pipeline. :)

Lets me suggest, if any improvement in pipeline.





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