GStreamer 1.2 on the Raspberry Pi

如果网络条件允许,建议看原文。原文地址:http://www.onepitwopi.com/raspberry-pi/gstreamer-1-2-on-the-raspberry-pi/


The Raspberry Pi is a very versatile little computer. Generally, if you can think of something you would like to do, good chance the Pi can do it.

I have a time lapse project that I am working with a Pi and the camera module. I thought, wouldn’t it be nice if after finishing taking the photos the Pi created the video for me as well. After a quick Google I found two helpful posts here and here. They got me up and going but the video creation took hours depending on how many photos you took.

Back to Google and some more searching showed me that the pi has hardware H264 encoding and should be able to create the video easy. And it does once you have the right software installed. What was taking hours to make had been cut down to minutes. I can’t remember the exact time difference, but GStreamer was making the video about 60x faster than avconv could at least.

Gstreamer can be a very complicated thing to figure out. It runs on the command line through what they call a pipeline. A pipeline is lots a commands separated by an !. Here is the one I use to convert the pictures to an MP4 video.

I don’t know how to use GStreamer for anything else, but it works very well for this. Gstreamer 0.10 can be installed on the Pi using sudo apt-get install gstreamer.010 . But that version doesn’t have the hardware encoding in it. Someone has created the install binaries for GStreamer 1.0 and hosted them in a repo. This page shows how to install it that way. I tried that but it wouldn’t work for me. What I am going to run you through is installing GStreamer 1.2 from source. It takes a little over 8 hours to compile so I recommend running it overnight.

I found this guide which helped me get on my way, and this page which had someone’s shell script they used to install 1.0. I have merged all the info I have found and put it all together. Despite taking so long to install it is actually a really easy process. If you are installing it through SSH I recommend you install screen on the Raspberry Pi.

There is a guide here on how to use it. After it has installed just type screen  to launch it. What it does is open a virtual terminal so that if you close you SSH session, whatever was running keeps running. So once in a screen window we type:

This will start the install script. As mentioned, it will take over 8 hours so don’t wait around for it to finish. Once it has finished we just need to edit a file and restart the Pi.

Once inside the file we need to add four new lines to the bottom. Here is a good guide on using nano if you need some pointers.

A quick reboot of the Pi and we are all done

Now if you type in  gst-inspect-1.0 | grep omx  it will show that the hardware encoders are available.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值