Optimising H264enc pipeline
Peter Maersk-Moller
pmaersk at gmail.com
Tue Mar 18 12:40:24 PDT 2014
Hi
What is the source of the video (where is the shmsrc gettings its video)?
A couple of things.
1) You specify frame rate to be 1/24. I assume you want to specify 24/1.
The difference is significant.
2) You have specified a queue of just 2 buffers. That's a bit aggressive
and it might not do what you want taking into account your video source
might have a lot of buffers. Howmany does your source have?
3) You have a video scale from 1024x768 to 1024x768 in the BGRA domain.
Since you don't scale you can quite likely skip it. I assume that GStreamer
just passes buffers without any actual modification, so it is not so bad.
4) You have a queue after videoscale and before encoding. That one you can
skip as it is not needed.
5) You have an extra ffmpegcolorspace not needed. Hmm it looks like a
generic code I have seen before ;-)
6) You have an alignment parameter for mpegtsmux. That does not exist for
GStreamer 0.10
7) 1200kbps might be a bit to aggressive for the selecting coding
parameters, but you can try.
I have rearranged the code a bit and kept the ability to resize stream
before encoding.
The below pipeline works well on an old Thinkpad T61 and uses only 35% out
of 200%.
VIDEO_IN='video/x-raw-rgb, bpp=(int)32, depth=(int)32,
endianness=(int)4321,red_mask=(int)65280, green_mask=(int)16711680,
blue_mask=(int)-16777216,pixel-aspect-ratio=(fraction)1/1,
interlaced=(boolean)false,width=(int)1024, height=(int)768,
framerate=(fraction)24/1'
VIDEO_OUT='video/x-raw-yuv, profile=(string)main, format=(fourcc)I420,
framerate=(fraction)24/1, width=(int)1024, height=(int)576,
pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false'
gst-launch-0.10 -v shmsrc socket-path=/tmp/socket do-timestamp=true
is-live=true ! \
queue leaky=2 max-size-buffers=2 !\
$VIDEO_IN !\
videoscale !\
ffmpegcolorspace !\
$VIDEO_OUT !\
videoscale !\
x264enc bitrate=1200 tune=zerolatency speed-preset=2
key-int-max=20 cabac=false ! \
'video/x-h264, profile=main' !\
h264parse !\
queue !\
mpegtsmux ! !\
chopmydata max-size=1316 min-size=1316 !\
udpsink clients=224.0.0.5:1234 auto-multicast=true sync=false
Best regards
Peter Maersk-Moller
On Tue, Mar 18, 2014 at 7:39 PM, buzzy <zygjys at gmail.com> wrote:
> Hello,
>
> we need to optimize the pipeline which has socket as an input and outputs
> to
> udp after H264 encoding. The following pipeline looks like this:
>
>
> ============================================================================
> gst-launch-0.10 -v shmsrc socket-path=/tmp/socket do-timestamp=true
> is-live=true ! \
> queue leaky=2 max-size-buffers=2
> ! \
> video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321,
> red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216,
> pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false',
> width=(int)'1024', height=(int)'768', framerate=(fraction)'1/24'
> ! \
> videoscale
> ! \
> ffmpegcolorspace
> ! \
> video/x-raw-rgb, bpp=(int)32, depth=(int)32, endianness=(int)4321,
> red_mask=(int)65280, green_mask=(int)16711680, blue_mask=(int)-16777216,
> pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false',
> width=(int)'1024', height=(int)'768', framerate=(fraction)'1/24'
> ! \
> queue
> ! \
> ffmpegcolorspace
> ! \
> x264enc bitrate=1200 tune=zerolatency speed-preset=2
> key-int-max=20
> cabac=false ! \
> 'video/x-h264, profile=main'
> ! \
> h264parse
> ! \
> queue
> ! \
> mpegtsmux alignment=7 ! chopmydata max-size=1316 min-size=1316
> ! \
> udpsink clients=224.0.0.5:1234 auto-multicast=true sync=false
>
> ============================================================================
> (The pipeline could not work out of the box because I've changed env/shell
> variables to actual elements and didn't test it).
> So, the problem is that this pipeline uses almost 50% of CPU and we wish to
> reduce this number. The resolution, framerate and bitrate are already the
> lowest values thats accepted. Output stream must be H264/MP4 video.
> What could be the tips to reduce the CPU load? What options to use? Maybe
> start using Gstreamer1.0?
> Thank you!
>
>
>
> --
> View this message in context:
> http://gstreamer-devel.966125.n4.nabble.com/Optimising-H264enc-pipeline-tp4666006.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140318/894f141b/attachment.html>
More information about the gstreamer-devel
mailing list