gstreamer examples

3,153 views
Skip to first unread message

Leonardo Bueno

unread,
Mar 15, 2012, 9:38:52 PM3/15/12
to panda...@googlegroups.com
Hi,

    Could you please share some examples of using gstreamer with ducati encoders/decoders? Ex:

1) Capture from webcam and encode in a file

2) Read from file decode and display

    I promise I'll try to get the wiki update with any working replies.

Thanks,

Leonardo

Joaquin Castellanos

unread,
Mar 20, 2012, 1:48:20 PM3/20/12
to panda...@googlegroups.com
Hi,

Here some gstreamer pipelines I use to test the codecs

$ time gst-launch playbin2 uri=file:///home/jjcgp0/Videos/MPEG4_VGA_AAC_HE.3gp  -v &
$ time gst-launch playbin2 uri=file:///home/jjcgp0/Videos/Serenity-HD-DVD-Trailer.mp4  -v &
$ time gst-launch playbin2 uri=file:///home/jjcgp0/Videos/Fantastic_Four-Rise_of_the_Silver_Surfer-Trailer.mp4 -v
$ time gst-launch playbin2 uri=file:///home/jjcgp0/Videos/bbc_1080p.mov -v

With the -v you can see n your terminal wich gst-elements were used in the pipeline


Ducati encoders didn't work for me. I tried Ubuntu Oneric 11.10 prebuild binaries on a Pandaboard rev A3,  but there is a patch that still needs to be included in the release to make them work.

 -----------------------------------
  ducatimpeg4enc: MPEG4 Encoder
 -----------------------------------
$ gst-launch -v videotestsrc  num-buffers=200   ! tee name=tee tee.src1 ! queue ! pvrvideosink  tee.src2 ! queue !   ducatimpeg4enc  bitrate=102400 ! fakesink -v   --gst-debug="*ducati*:5"
  -----------------------------------  

  -----------------------------------  
  ducatih264enc: H264 Encoder
  -----------------------------------  
$ gst-launch -v videotestsrc  num-buffers=200   ! tee name=tee tee.src1 ! queue ! pvrvideosink  tee.src2 ! queue !   ducatih264enc bitrate=102400 profile=baseline level=level-4  ! fakesink -v   --gst-debug="*ducati*:5"
  -----------------------------------  

Best regards
Joaquin Castellanos

Leonardo Bueno

unread,
Mar 24, 2012, 6:48:26 PM3/24/12
to panda...@googlegroups.com
 Hi,

     After apt-get update/upgrade the gstreamer ducati encoder/decoder started working!

     Here's how I captured from the webcam and recorded into a mp4 file:

 sudo gst-launch -v v4l2src device=/dev/video3 num-buffers=200 ! "video/x-raw-yuv, width=640, height=480,framerate=30/1" ! queue ! ffmpegcolorspace ! ducatih264enc ! h264parse ! queue! qtmux ! filesink location=sample.mp4

      Avg CPU usage was 34% at 640x480 and 66% at 1280x720. Some of the elements above may not be necessary, not sure if I need h264parse and all these queues.

     Playback uses a lot less CPU, usualy between 1% and 3%:

      sudo gst-launch -v playbin2 uri=file:///home/leonardo/sample.mp4

Thanks!

Leonardo Bueno

Nicolas Dechesne

unread,
Mar 26, 2012, 4:46:21 AM3/26/12
to panda...@googlegroups.com
On Sat, Mar 24, 2012 at 11:48 PM, Leonardo Bueno
<leonard...@gmail.com> wrote:
>      After apt-get update/upgrade the gstreamer ducati encoder/decoder
> started working!

good. thx for reporting!

>
>      Here's how I captured from the webcam and recorded into a mp4 file:
>
>  sudo gst-launch -v v4l2src device=/dev/video3 num-buffers=200 !
> "video/x-raw-yuv, width=640, height=480,framerate=30/1" ! queue !
> ffmpegcolorspace ! ducatih264enc ! h264parse ! queue! qtmux ! filesink
> location=sample.mp4
>
>       Avg CPU usage was 34% at 640x480 and 66% at 1280x720. Some of the
> elements above may not be necessary, not sure if I need h264parse and all
> these queues.

pipeline looks ok. the CPU load is coming from ffmpegcolorspace which
is required since the ducati encoders will take NV12 buffer format
only. the CPU cost of this conversion clearly depends on your
resolution.

>
>      Playback uses a lot less CPU, usualy between 1% and 3%:
>
>       sudo gst-launch -v playbin2 uri=file:///home/leonardo/sample.mp4

this is expected, since there is nothing done by CPU (more or less)
for video playback. The decoding is one the IVAHD, it produces NV12
buffers that are rendered by the GPU.

Joaquin Castellanos

unread,
Mar 26, 2012, 7:20:10 PM3/26/12
to panda...@googlegroups.com
Thanks, for the tip.  After update, upgrade and reset  ducatih264enc and ducatimpeg4enc also worked for me   =)

------------------
 gst-launch  v4l2src device=/dev/video3  num-buffers=200  ! "video/x-raw-yuv, width=(int)640, height=(int)480, framerate=30/1" ! queue ! ffmpegcolorspace !  tee name=tee tee.src1 ! queue ! autovideosink   tee.src2 ! queue ! ducatih264enc ! h264parse ! queue! qtmux ! filesink location=sample2.mp4

time gst-launch playbin2 uri=file:///home/jjcgp0/Videos/sample2.mp4

------------------
 gst-launch -v v4l2src device=/dev/video3 num-buffers=200 ! "video/x-raw-yuv, width=640, height=480,framerate=30/1" ! queue ! ffmpegcolorspace ! ducatimpeg4enc ! queue ! mpeg4videoparse ! qtmux ! filesink location=sample4.mp4 --gst-debug="*ducati*:5"


 time gst-launch playbin2 uri=file:///home/jjcgp0/Videos/sample4.mp4
------------------
Best regards
Joaquín Castellanos
Reply all
Reply to author
Forward
0 new messages