Gentoo Archives: gentoo-user

From: Leonardo Guilherme <leonardo.guilherme@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] using ffmpeg for screen cast
Date: Mon, 27 Jun 2011 14:16:49
Message-Id: BANLkTi=vjH8gMRHSnUDfTYX-BTekLDRC=Q@mail.gmail.com
In Reply to: Re: [gentoo-user] [OT] using ffmpeg for screen cast by Mick
1 2011/6/27 Mick <michaelkintzios@×××××.com>
2
3 > On Monday 27 Jun 2011 12:08:17 Stroller wrote:
4 > > On 26 June 2011, at 19:54, Mick wrote:
5 >
6 > > >> Try passing "-sameq"
7 > > >
8 > > > WOW! Exceptional improvement in a single stroke! Thanks! :)
9 > > >
10 > > > Why is it that ffmpeg degrades the quality with default settings? What
11 > > > does it assume that the setting is? (sorry for the newbie Qs, but this
12 > > > area is until now outside my cognitive map! ;-)
13 > >
14 > > I don't know about the "default" settings, but I would interpret the file
15 > > extension of your original command as telling mplayer that "the
16 > > destination file should be encoded as mpeg2". This is a pretty poor codec
17 > > by today's standards.
18 > >
19 > > I could well be wrong, though. Do you know what format the output file
20 > is?
21 >
22 > No, I have no idea. I assume it is capturing my desktop in some raw video
23 > format - whatever that means. What would X11 feed to x11grab?
24 >
25 >
26 > > IMO you're best encoding to h264 (in an mp4 container) for distribution,
27 > > but I think it's possible the encoding load of that might affect your
28 > > screencast. So you might wish to use sameq or the r210 or rawvideo codecs
29 > > and then transcode to h264 (or WebM or whatever) afterwards.
30 >
31 > I changed the output file to mp4 and it transcodes it accordingly! :)
32 >
33 > ffmpeg -f x11grab -s xga -r 25 -i :0.0 -sameq -aspect 4:3 /tmp/out.mp4
34 > FFmpeg version SVN-r25767, Copyright (c) 2000-2010 the FFmpeg developers
35 > built on Jan 30 2011 17:04:59 with gcc 4.4.4
36 > configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --
37 > mandir=/usr/share/man --enable-static --enable-shared --cc=x86_64-pc-linux-
38 > gnu-gcc --enable-gpl --enable-version3 --enable-postproc --enable-avfilter
39 > --
40 > disable-stripping --disable-debug --disable-doc --disable-network
41 > --disable-
42 > static --disable-vdpau --enable-libmp3lame --enable-libvorbis
43 > --enable-libx264
44 > --enable-libxvid --enable-libfaac --enable-nonfree --disable-indev=v4l --
45 > disable-indev=oss --disable-indev=jack --enable-x11grab
46 > --disable-outdev=oss
47 > --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-librtmp --
48 > disable-altivec --cpu=core2 --enable-hardcoded-tables
49 > libavutil 50.33. 0 / 50.33. 0
50 > libavcore 0.13. 0 / 0.13. 0
51 > libavcodec 52.96. 0 / 52.96. 0
52 > libavformat 52.84. 0 / 52.84. 0
53 > libavdevice 52. 2. 2 / 52. 2. 2
54 > libavfilter 1.62. 0 / 1.62. 0
55 > libswscale 0.12. 0 / 0.12. 0
56 > libpostproc 51. 2. 0 / 51. 2. 0
57 > [x11grab @ 0x1a52510] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1024
58 > height: 768
59 > [x11grab @ 0x1a52510] shared memory extension found
60 > [x11grab @ 0x1a52510] Estimating duration from bitrate, this may be
61 > inaccurate
62 > Input #0, x11grab, from ':0.0':
63 > Duration: N/A, start: 1309180986.812527, bitrate: 629145 kb/s
64 > Stream #0.0: Video: rawvideo, bgra, 1024x768, 629145 kb/s, 25 tbr, 1000k
65 > tbn, 25 tbc
66 > [buffer @ 0x1a7db80] w:1024 h:768 pixfmt:bgra
67 > [ffsink @ 0x1a7ddf0] auto-inserting filter 'auto-inserted scaler 0' between
68 > the filter 'src' and the filter 'out'
69 > [scale @ 0x1a7e110] w:1024 h:768 fmt:bgra -> w:1024 h:768 fmt:yuv420p
70 > flags:0xa0000004
71 > Output #0, mp4, to '/tmp/out.mp4':
72 > Metadata:
73 > encoder : Lavf52.84.0
74 > Stream #0.0: Video: mpeg4, yuv420p, 1024x768 [PAR 1:1 DAR 4:3], q=2-31,
75 > 200 kb/s, 25 tbn, 25 tbc
76 > Stream mapping:
77 > Stream #0.0 -> #0.0
78 > Press [q] to stop encoding
79 > frame= 14 fps= 0 q=0.0 size= 702kB time=0.68 bitrate=8454.1kbits/s
80 > dup=frame= 27 fps= 25 q=0.0 size= 1056kB time=1.20
81 > bitrate=7212.1kbits/s
82 > dup=frame= 40 fps= 25 q=0.0 size= 1411kB time=1.72
83 > bitrate=6720.9kbits/s
84 > dup=
85 > [snip...]
86 >
87 >
88 > Then it plays it as such:
89 >
90 > mplayer /tmp/out.mp4
91 > MPlayer SVN-r32624-4.4.4 (C) 2000-2010 MPlayer Team
92 >
93 > Playing /tmp/out.mp4.
94 > libavformat file format detected.
95 > [lavf] stream 0: video (mpeg4), -vid 0
96 > VIDEO: [MP4V] 1024x768 24bpp 25.000 fps 5798.3 kbps (707.8 kbyte/s)
97 > Clip info:
98 > major_brand: isom
99 > minor_version: 512
100 > compatible_brands: isomiso2mp41
101 > encoder: Lavf52.84.0
102 > ==========================================================================
103 > Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
104 > Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
105 > ==========================================================================
106 > Audio: no sound
107 > Starting playback...
108 > Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
109 > VO: [xv] 1024x768 => 1024x768 Planar YV12
110 > V: 19.1 0/ 0 5% 0% 0.0% 0 0
111 >
112 >
113 > Exiting... (End of file)
114 >
115 >
116 > Not sure how to define the vcodec to be h264. Is ffodivx the same as h264?
117 >
118 >
119 > > > Now, I hope I'm not getting greedy, but how do I add voice recording to
120 > > > the above stanza? Or do I have to record voice and then package it
121 > > > along with the video in a container as a separate step?
122 > >
123 > > EXAMPLES
124 > > Video and Audio grabbing
125 > > FFmpeg can grab video and audio from devices given that you
126 > specify
127 > > the input format and device.
128 > >
129 > > ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0
130 > > /tmp/out.mpg
131 > >
132 > > Note that you must activate the right video source and channel
133 > > before launching FFmpeg with any TV viewer such as xawtv
134 > > (<http://linux.bytesex.org/xawtv/>) by Gerd Knorr. You also have
135 > to
136 > > set the audio recording levels correctly with a standard mixer.
137 > >
138 > > Audacity is widely used for simple audio editing.
139 >
140 > Great! Thanks Stroller. :)
141 >
142 > --
143 > Regards,
144 > Mick
145 >
146
147 This link was very helpful to me, maybe it can be to you:
148
149 http://verb3k.wordpress.com/2010/01/26/how-to-do-proper-screencasts-on-linux/

Replies

Subject Author
Re: [gentoo-user] [OT] using ffmpeg for screen cast Mick <michaelkintzios@×××××.com>