User avatar
Defiant
Posts: 181
Joined: Tue Oct 30, 2012 6:17 pm
Location: Hamburg, Germany

Re: GStreamer 1.0

Mon Jul 08, 2013 4:47 pm

What about mythtv+xbmc?

danversj
Posts: 14
Joined: Sat Jul 06, 2013 2:53 am

Re: GStreamer 1.0

Tue Jul 09, 2013 10:57 am

I had a good go with mythtv earlier this year - that is a good suggestion as it does have transcoding ability. But I've found that the setup is very finicky - it's very hard to get working, I find. I found tvheadend to be much easier and more stable. There's a transcoding fork of tvheadend which looks promising. But mostly I really want to use the Pi's hardware encoding ability - I like the idea of a cheap, powerful transcoder doing the job - once set up it will be cheap and easy to replicate. Screencasting the XBMC GUI+Video Playback seems the easiest way to do it, without having to re-engineer XBMC's internals.

After writing my post last night I found that ffmpeg can access the linux /dev/fb0 virtual framebuffer - I've tried with the avconv version of ffmpeg but it didn't work. I might try compiling the ffmpeg ffmpeg. :) If ffmpeg can access /dev/fb0 I can try piping it to gstreamer.

danversj
Posts: 14
Joined: Sat Jul 06, 2013 2:53 am

Re: GStreamer 1.0

Wed Jul 10, 2013 11:32 am

Updating on my progress:

I'm able to grab /dev/fb0 about once a second and record it as a .h264 file. But I'm not able to mux it into any kind of useful container. Here's my pipeline:

Code: Select all

gst-launch-1.0 -v multifilesrc location=/dev/fb0 ! videoparse format=29 width=1680 height=1080 framerate=30/1 ! decodebin ! videoconvert ! omxh264enc ! filesink location=test.h264
This example gives me watchable video, but there's no vertical sync - the picture rolls upwards. Seems like the start of each frame is not being detected. If I try to mux it into a .ts file like so:

Code: Select all

gst-launch-1.0 -v multifilesrc location=/dev/fb0 ! videoparse format=29 width=1680 height=1080 framerate=30/1 ! decodebin ! videoconvert ! omxh264enc ! mpegtsmux ! filesink location=test.ts
I get this:

Code: Select all

ERROR: from element /GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0: GStreamer error: negotiation problem.
Additional debug info:
gstvideoencoder.c(1363): gst_video_encoder_chain (): /GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0:
encoder not initialized
ERROR: pipeline doesn't want to preroll.
If I use the fbdev format with ffmpeg (either the avconv or ffmpeg version) I get a "Pixel format not supported" error

Code: Select all

pi@raspberrypi ~/videos/test $ /usr/bin/ffmpeg -f fbdev -vframes 1 -i /dev/fb0 scrnshot-avconv01.jpg
ffmpeg version 0.8.6-6:0.8.6-1+rpi1, Copyright (c) 2000-2013 the Libav developers
  built on Mar 31 2013 13:58:10 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[fbdev @ 0x1fd2660] Framebuffer pixel format not supported.
/dev/fb0: Invalid argument

Code: Select all

pi@raspberrypi ~/videos/test $ /usr/local/bin/ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul  9 2013 14:47:41 with gcc 4.6 (Debian 4.6.3-14+rpi1)
  configuration:
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
[fbdev @ 0x2bb4430] Framebuffer pixel format not supported.
/dev/fb0: Invalid argument
Running "fbset" I see that the Pi's framebuffer pixel format is RGB565 (for ffmpeg, anyway). This works in getting a single frame:

Code: Select all

pi@raspberrypi ~/videos/test $ /usr/local/bin/ffmpeg -f rawvideo -codec:v rawvideo -s 1680x1050 -pix_fmt rgb565le -frames:v 1 -r 1 -i /dev/fb0 screenshot-ff01.bmp
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul  9 2013 14:47:41 with gcc 4.6 (Debian 4.6.3-14+rpi1)
  configuration:
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
[rawvideo @ 0x206d5d0] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from '/dev/fb0':
  Duration: N/A, start: 0.000000, bitrate: 28224 kb/s
    Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1680x1050, 28224 kb/s, 1 tbr, 1 tbn, 1 tbc
File 'screenshot-ff01.bmp' already exists. Overwrite ? [y/N] y
Output #0, image2, to 'screenshot-ff01.bmp':
  Metadata:
    encoder         : Lavf54.63.104
    Stream #0:0: Video: bmp, rgb565le, 1680x1050, q=2-31, 200 kb/s, 90k tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> bmp)
Press [q] to stop, [?] for help
[rawvideo @ 0x20763a0] Invalid buffer size, packet size 20160 < expected length 3528000
Error while decoding stream #0:0: Invalid argument
frame=    1 fps=0.6 q=0.0 Lsize=N/A time=00:00:01.00 bitrate=N/A
video:3445kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000624%
But I can't get multiple frames as a live stream this way - /dev/fb0 does an EOS after every frame. I've tried -loop 0 or -loop_input but this only works with the image2 format, and image2 doesn't work with /dev/fb0.

Pixel Format rgb565le in ffmpeg is (I think, but not completely sure) RGB16 or RGB15 in gstreamer. In the first example, this is videoparse format=29 or format=31, respectively.

And I'm stuck here. Can anyone offer suggestions to getting a better result in streaming from the framebuffer on the Pi?

rg57
Posts: 12
Joined: Sun Jun 24, 2012 8:24 pm

Re: GStreamer 1.0

Thu Oct 03, 2013 1:56 pm

Were you able to find a solution to the pixel format problem with avconv/ffmpeg?

I was hoping to be able to use a slow frame rate to record a video of the screen, for use in testing. But I run into the same error you reported.

danversj
Posts: 14
Joined: Sat Jul 06, 2013 2:53 am

Re: GStreamer 1.0

Thu Oct 03, 2013 9:20 pm

if you compile from source a recent (more recent than my last reply) version of ffmpeg you'll find that fbdev now works on the pi. I would like to see some dispmanx support in gstreamer though.

rg57
Posts: 12
Joined: Sun Jun 24, 2012 8:24 pm

Re: GStreamer 1.0

Sat Oct 05, 2013 9:15 am

Thanks. I compiled the latest ffmpeg, and it did work for me in a brief test with this command line:

Code: Select all

sudo ffmpeg -f fbdev -r 20 -i /dev/fb0 this_test.mpg
I had heard that compiling ffmpeg might take overnight on a Raspberry Pi, but mine seemed to complete in only a few hours (or sooner... I left and came back and it was done).
There are some YouTube videos about how to record a Linux console, without ever starting a GUI, so anyone looking for help recording their console, for example for testing purposes, may look there.

Anita
Posts: 13
Joined: Thu Nov 21, 2013 10:25 am

Re: GStreamer 1.0

Mon Dec 16, 2013 9:38 am

Failed to compile gstremer1.0 packages.
i downloaded from the link : http://cgit.freedesktop.org/gstreamer/gstreamer/

make[5]: Entering directory `/usr/src/gstreamer-1.x/gstreamer/docs/gst'
dot -Tsvg gst-universe.dot | sed 's/\(font-size:[0-9]*\.[0-9]*\);/\1px;/g' >gst-universe.svg
/bin/bash: dot: command not found
DOC Scanning header files
DOC Introspecting gobjects
gtk-doc: Compiling scanner
libtool: compile: gcc -std=gnu99 -I../../libs -I../.. -I../../libs -I../.. -pthread -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -DG_THREADS_MANDATORY -DG_DISABLE_DEPRECATED -Wall -Wdeclaration-after-statement -Wvla -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs -g -DGST_DISABLE_DEPRECATED -g -O2 -c gstreamer-scan.c -fPIC -DPIC -o .libs/gstreamer-scan.o
gtk-doc: Linking scanner
libtool: link: gcc -std=gnu99 -o .libs/gstreamer-scan .libs/gstreamer-scan.o -pthread -L/usr/local/lib /usr/local/lib/libgobject-2.0.so /usr/local/lib/libgmodule-2.0.so -lrt /usr/local/lib/libglib-2.0.so ../../gst/.libs/libgstreamer-1.0.so ../../libs/gst/base/.libs/libgstbase-1.0.so ../../libs/gst/controller/.libs/libgstcontroller-1.0.so ../../libs/gst/net/.libs/libgstnet-1.0.so -pthread
gtk-doc: Running scanner gstreamer-scan
/usr/src/gstreamer-1.x/gstreamer/docs/gst/.libs/lt-gstreamer-scan: symbol lookup error: /usr/src/gstreamer-1.x/gstreamer/libs/gst/base/.libs/libgstbase-1.0.so.0: undefined symbol: g_cclosure_marshal_generic
Scan failed:
make[5]: *** [scan-build.stamp] Error 127
make[5]: Leaving directory `/usr/src/gstreamer-1.x/gstreamer/docs/gst'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/usr/src/gstreamer-1.x/gstreamer/docs/gst'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/src/gstreamer-1.x/gstreamer/docs'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/src/gstreamer-1.x/gstreamer/docs'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/gstreamer-1.x/gstreamer'
make: *** [all] Error 2

djohnanderson
Posts: 1
Joined: Mon Jan 13, 2014 3:10 am

Re: GStreamer 1.0

Mon Jan 13, 2014 3:17 am

Try this script to build GStreamer. It builds the latest stable release as of January 2014 -- but be prepared to wait for 5 or more hours for it to complete. Let me know if you have any problems with it

Code: Select all

#!/bin/bash -v         

sudo apt-get install -y build-essential autotools-dev automake autoconf \
                        libtool autopoint libxml2-dev zlib1g-dev libglib2.0-dev \
                        pkg-config bison flex python git gtk-doc-tools libasound2-dev \
                        libgudev-1.0-dev libxt-dev libvorbis-dev libcdparanoia-dev \
                        libpango1.0-dev libtheora-dev libvisual-0.4-dev iso-codes \
                        libgtk-3-dev libraw1394-dev libiec61883-dev libavc1394-dev \
                        libv4l-dev libcairo2-dev libcaca-dev libspeex-dev libpng-dev \
                        libshout3-dev libjpeg-dev libaa1-dev libflac-dev libdv4-dev \
                        libtag1-dev libwavpack-dev libpulse-dev libsoup2.4-dev libbz2-dev \
                        libcdaudio-dev libdc1394-22-dev ladspa-sdk libass-dev \
                        libcurl4-gnutls-dev libdca-dev libdirac-dev libdvdnav-dev \
                        libexempi-dev libexif-dev libfaad-dev libgme-dev libgsm1-dev \
                        libiptcdata0-dev libkate-dev libmimic-dev libmms-dev \
                        libmodplug-dev libmpcdec-dev libofa0-dev libopus-dev \
                        librsvg2-dev librtmp-dev libschroedinger-dev libslv2-dev \
                        libsndfile1-dev libsoundtouch-dev libspandsp-dev libx11-dev \
                        libxvidcore-dev libzbar-dev libzvbi-dev liba52-0.7.4-dev \
                        libcdio-dev libdvdread-dev libmad0-dev libmp3lame-dev \
                        libmpeg2-4-dev libopencore-amrnb-dev libopencore-amrwb-dev \
                        libsidplay1-dev libtwolame-dev libx264-dev libusb-1.0

cd $HOME
mkdir packages
cd packages/ 
mkdir gstreamer-1.x
cd gstreamer-1.x	

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

git clone -n git://anongit.freedesktop.org/git/gstreamer/gstreamer
cd gstreamer
git checkout -t origin/1.2
./autogen.sh 
make -j3
sudo make install
cd ..

git clone -n git://anongit.freedesktop.org/git/gstreamer/gst-plugins-base
cd gst-plugins-base
git checkout -t origin/1.2
./autogen.sh
make -j3
sudo make install
cd ..

git clone -n git://anongit.freedesktop.org/git/gstreamer/gst-plugins-good
cd gst-plugins-good
git checkout -t origin/1.2
./autogen.sh 
make -j3
sudo make install
cd ..

git clone -n git://anongit.freedesktop.org/git/gstreamer/gst-plugins-ugly
cd gst-plugins-ugly
git checkout -t origin/1.2
./autogen.sh 
make -j3
sudo make install
cd ..

git clone -n git://anongit.freedesktop.org/git/gstreamer/gst-libav
cd gst-libav
git checkout -t origin/1.2
./autogen.sh
make -j3
sudo make install
cd ..

git clone -n git://anongit.freedesktop.org/git/gstreamer/gst-plugins-bad
cd gst-plugins-bad
git checkout -t origin/1.2
./autogen.sh 
make -j3
sudo make install
cd ..

git clone -n git://anongit.freedesktop.org/git/gstreamer/gst-omx
cd gst-omx
git checkout -t origin/1.0
./autogen.sh --with-omx-target=rpi
make -j3
sudo make install

gst-inspect-1.0 | grep omx

User avatar
Defiant
Posts: 181
Joined: Tue Oct 30, 2012 6:17 pm
Location: Hamburg, Germany

Re: GStreamer 1.0

Mon Jan 13, 2014 6:04 am

I wonder, do the above commands leave you with a working eglglessink?
Also it looks like it will install everything into /usr/local.

Return to “Media centres”