Gentoo Archives: gentoo-user

From: meino.cramer@×××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT} GStreamer: How to view AND record a stream coming from an USB Webcam
Date: Mon, 16 Jun 2014 18:27:19
Message-Id: 20140616182708.GB3872@solfire
In Reply to: Re: [gentoo-user] [OT} GStreamer: How to view AND record a stream coming from an USB Webcam by "Canek Peláez Valdés"
1 Canek Peláez Valdés <caneko@×××××.com> [14-06-16 04:33]:
2 > On Sun, Jun 15, 2014 at 1:04 PM, Canek Peláez Valdés <caneko@×××××.com> wrote:
3 > > On Sun, Jun 15, 2014 at 12:54 PM, <meino.cramer@×××.de> wrote:
4 > >> Hi,
5 > >>
6 > >> After unsuccessfully trying vlc with a Logitech C920 HD Pro Webcam
7 > >> (over 2 seconds delay between audio and video). I played around
8 > >> with gstreamer and from bits and pieces from the web I build
9 > >> this line:
10 > >>
11 > >> gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-h264,width=1920,height=1080,framerate=30/1 ! \
12 > >> h264parse ! muxout. alsasrc device="hw:3,0" ! queue ! audioconvert ! lamemp3enc ! \
13 > >> muxout. matroskamux name=muxout streamable=true ! filesink location=c920.mp4
14 > >>
15 > >> which records a Full HD video with audio to my harddisc. The delay is
16 > >> minimal and the sync between audio and video is good.
17 > >>
18 > >> But there is one disadvantage:
19 > >> I cannot see what I am recording and I cannot watch the webcams stream
20 > >> before I fire up the script because otherwise the device would be "already
21 > >> in use" (I dont like scripts, which simply kill other applications when
22 > >> called).
23 > >>
24 > >> Any ideas or hints how to manage that?
25 > >
26 > > Use the tee element. I'm in a hurry, so I cannot test a pipeline right
27 > > now, but I will try later. Meanwhile, just try to put a queue element
28 > > after each path of the tee.
29 > >
30 > > gst-inspect-1.0 tee
31 >
32 > OK, it took me a bit of an effort, but this is my pipeline:
33 >
34 > gst-launch-1.0 v4l2src norm=NTSC device=/dev/video1 ! queue !
35 > deinterlace mode=1 ! videorate !
36 > video/x-raw,format=YV12,width=720,height=480,framerate=30000/1001 !
37 > tee name=t t. ! queue ! videoconvert ! mpeg2enc ! avimux ! filesink
38 > location=file.avi t. ! queue ! videoconvert ! autovideosink
39 >
40 > My hardware is much more limited (analog RGB), so resolution and
41 > famerate are accordingly lower. This captures to an AVI file encoded
42 > to MPEG2 the video signal, and at the same time it opens a window to
43 > show the stream.
44 >
45 > It should not be that much of a problem to modify it to your needs;
46 > just notice that I didn't capture audio.
47 >
48 > Regards.
49 > --
50 > Canek Peláez Valdés
51 > Profesor de asignatura, Facultad de Ciencias
52 > Universidad Nacional Autónoma de México
53 >
54
55 Hi Canek,
56
57 Thanks a lot for your effort!!! 8)
58
59 Is there any documentation out there about this "How to build
60 a pipeline with gst-launch", which you would recommend to read?
61
62 I will see how I can map your example to my code I have already, which
63 handles audio and video...
64
65 Best regards,
66 mcc

Replies

Subject Author
Re: [gentoo-user] [OT} GStreamer: How to view AND record a stream coming from an USB Webcam "Canek Peláez Valdés" <caneko@×××××.com>