[FFmpeg-user] Sound or Video - but I can't get both to work...

Bradley D. Thornton Bradley at NorthTech.US
Thu Jun 16 12:05:45 CEST 2011


This is really, really weird if you ask me...

On 06/13/2011 03:23 AM, Bradley D. Thornton wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
>
>
> On 06/13/2011 03:14 AM, Fabian Lesniak wrote:
>> The problem may be your sound card: AFAIK, you can only record your local
>> playback (PCM) when your sound card supports to set it as a "recording"
>> channel. You may try if you can set capture to your pcm via alsamixer.
>> And specifying the -f parameter before -i is okay in this case, because it
>> tells ffmpeg to not read a file named "hw:0,0" but open hw:0,0 using alsa. You
>> may also try to open the "default" device.
>> I did my last screen capture some time ago, but I noted the following:
>>
>> sox -t alsa "hw:0,0" -t ogg -A -2 -c1 -r44100 - | ffmpeg -i - -f x11grab -s
>> 1280x1024 -g 300 -r 15 -i :0.0 -s 640x512 -ab 128k -ar 44100 -b 1500k -vc
>> mpeg4 out.avi
>>
>> As you can see, I used sox to record audio, but I don't actually know anymore
>> why I did...
>

Okay, there's quality issues, and the sound lags a bit... but I suppose 
if it's consistently lagging by x% or X seconds I can fix that when I 
edit in kdenlive or openshot, etc.

Here's a variation on your command line that is beginning to pan out for 
me, but like I said, there's some issues to be worked out, and I'm 
basically blindfoled, with a stick in my hand, spun around and told to 
whack the pinata. IOW: I'll have to sort out everything on the command 
line later and begin to mold it into something workable.

sox -t alsa plughw:0 -t ogg -A -2 -c1 -r44100 - | ffmpeg -i - -f x11grab 
-s 1440x900 -g 300 -r 15 -i :0.0 -s 1440x900 -ab 128k -ar 44100 -b 1500k 
-vc mpeg4 out.avi


Interestingly enough, I have found that if I set the screen resolution 
to 400x600 - I can get audio with a few other different command lines 
along the lines of:

ffmpeg -f alsa -i plughw:0 -f x11grab -r 30 -s 400x600 -i :0.0 -acodec 
libmp3lame -vcodec libx264 -vpre lossless_ultrafast output.avi

and...

ffmpeg -f alsa -i plughw:0 -f x11grab -r 30 -s 400x600 -i :0.0 -acodec 
libmp3lame -ab 128k -vcodec mpeg4 -b 1000k -qscale 10 output.avi


If I increase to even 800x600 - no audio.

As I was telling someone else, it's as if I've got all these straws, and 
I keep stacking the resolution higher with them until the camel just 
goes on strike :)

My resolution is 1440x900 too on this laptop! LOL. And although I 
*could* probably get by with just a capture of a single window of an 
xterm for now, and then add the audio in later for the entire desktop 
shots, I'm finding this rather weird, with consideration to the 
resolution breaking audio at anyhthing higher than 400x600.

~/$ ffmpeg -f alsa -i plughw:0 -f x11grab -r 30 -s 400x600 -i :0.0 
-acodec libmp3lame -vcodec libx264 -vpre lossless_ultrafast output.avi
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
   built on Feb  3 2011 00:17:04 with gcc 4.4.4
   configuration: --prefix=/usr --libdir=/usr/lib64 
--shlibdir=/usr/lib64 --mandir=/usr/man --enable-libmp3lame 
--enable-libfaac --enable-nonfree --enable-gpl --enable-version3 
--enable-postproc --enable-avfilter --enable-libdc1394 --enable-libfaad 
--enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-librtmp --enable-libschroedinger --enable-libspeex 
--enable-libtheora --enable-libvpx --enable-libx264 
--enable-runtime-cpudetect --enable-vaapi --disable-vdpau 
--enable-memalign-hack --enable-pthreads --enable-x11grab --enable-bzlib 
--enable-zlib --enable-shared --enable-static --disable-debug 
--arch=x86_64 --enable-pic 
--extra-cflags='-I/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/include 
-DRUNTIME_CPUDETECT' 
--extra-ldflags='-L/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/lib64 -lssl 
-lcrypto -lz -lusb'
   libavutil     50.15. 1 / 50.15. 1
   libavcodec    52.73. 2 / 52.73. 2
   libavformat   52.64. 2 / 52.64. 2
   libavdevice   52. 2. 0 / 52. 2. 0
   libavfilter    1.19. 0 /  1.19. 0
   libswscale     0.11. 0 /  0.11. 0
   libpostproc   51. 2. 0 / 51. 2. 0
[alsa @ 0x63a4f0]capture with some ALSA plugins, especially dsnoop, may 
hang.
[alsa @ 0x63a4f0]Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'plughw:0':
   Duration: N/A, start: 443109.438166, bitrate: N/A
     Stream #0.0: Audio: pcm_s16le, 44100 Hz, 1 channels, s16, 705 kb/s
[x11grab @ 0x65d0e0]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 400 
height: 600
[x11grab @ 0x65d0e0]shared memory extension  found
[x11grab @ 0x65d0e0]Estimating duration from bitrate, this may be inaccurate
Input #1, x11grab, from ':0.0':
   Duration: N/A, start: 1308215546.644068, bitrate: 230400 kb/s
     Stream #1.0: Video: rawvideo, bgra, 400x600, 230400 kb/s, 30 tbr, 
1000k tbn, 30 tbc
File 'output.avi' already exists. Overwrite ? [y/N] y
[libx264 @ 0x66a6b0]using cpu capabilities: MMX2 SSE2Slow SlowCTZ
[libx264 @ 0x66a6b0]profile High 4:4:4 Predictive, level 3.0, bit depth 8
Output #0, avi, to 'output.avi':
   Metadata:
     ISFT            : Lavf52.64.2
     Stream #0.0: Video: libx264, yuv420p, 400x600, q=10-51, 200 kb/s, 
30 tbn, 30 tbc
     Stream #0.1: Audio: libmp3lame, 44100 Hz, 1 channels, s16, 64 kb/s
Stream mapping:
   Stream #1.0 -> #0.0
   Stream #0.0 -> #0.1
Press [q] to stop encoding
[alsa @ 0x63a4f0]ALSA buffer xrun.
frame=   35 fps=  6 q=-1.0 Lsize=     115kB time=5.64 bitrate= 
167.2kbits/s
video:50kB audio:44kB global headers:0kB muxing overhead 22.449107%
[libx264 @ 0x66a6b0]frame I:1     Avg QP: 0.00  size: 29906
[libx264 @ 0x66a6b0]frame P:34    Avg QP: 0.00  size:   626
[libx264 @ 0x66a6b0]mb I  I16..4: 76.8%  0.0% 23.2%
[libx264 @ 0x66a6b0]mb P  I16..4: 53.4%  0.0%  0.0%  P16..4:  0.0%  0.0% 
  0.0%  0.0%  0.0%    skip:46.6%
[libx264 @ 0x66a6b0]coded y,uvDC,uvAC intra: 1.8% 2.7% 2.6% inter: 0.0% 
0.0% 0.0%
[libx264 @ 0x66a6b0]i16 v,h,dc,p: 99%  1%  0%  0%
[libx264 @ 0x66a6b0]i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 45%  5%  2%  1% 
1%  1%  1%  2%
[libx264 @ 0x66a6b0]i8c dc,h,v,p: 93%  2%  5%  0%
[libx264 @ 0x66a6b0]kb/s:351.02
~/$


Thanks again Fabian :)

>
>>
>> Am Montag, 13. Juni 2011, 04:11:26 schrieb Bradley D. Thornton:
>>> On 06/12/2011 06:58 PM, Reindl Harald wrote:
>>>> Am 13.06.2011 03:54, schrieb Bradley D. Thornton:
>>>>> I get video but no sound when I do this:
>>>>>
>>>>> ffmpeg -f alsa -i plughw:0,0 -f x11grab -r 25 -s 1440x900 -i :0.0
>>>>> -acodec pcm_s16le -vcodec huffyuv -sameq screencast.avi
>>>>>
>>>>> or this:
>>>>>
>>>>> ffmpeg -f alsa -ac 2 -i plughw:0,0 -f x11grab -r 25 -s 1440x900 -i :0.0
>>>>> -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0
>>>>> output.mkv
>>>>>
>>>>> -f oss (gives an error - no device) and I do not have pulse.
>>>>
>>>> why do you specifiy params before "-i"?
>>>> these are normally for the input-file and i guess
>>>> ffmpeg will in most cases know better what the input is
>>>
>>> That's what the tutorial here:
>>> http://verb3k.wordpress.com/2010/01/26/how-to-do-proper-screencasts-on-linu
>>> x/ gave as examples, and also what other people were offering up.
>>>
>>> I get the following errors when I try your suggestion with the
>>> corresponding command:
>>>
>>> <snip>
>>>
>>> ffmpeg -i plughw:0 -f x11grab -r 25 -s 1440x900 -i :0.0 -acodec
>>> pcm_s16le -vcodec huffyuv -sameq screencast.avi
>>>
>>> FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
>>>    built on Feb  3 2011 00:17:04 with gcc 4.4.4
>>>    configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
>>> --mandir=/usr/man --enable-libmp3lame --enable-libfaac --enable-nonfree
>>> --enable-gpl --enable-version3 --enable-postproc --enable-avfilter
>>> --enable-libdc1394 --enable-libfaad --enable-libgsm
>>> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp
>>> --enable-libschroedinger --enable-libspeex --enable-libtheora
>>> --enable-libvpx --enable-libx264 --enable-runtime-cpudetect
>>> --enable-vaapi --disable-vdpau --enable-memalign-hack --enable-pthreads
>>> --enable-x11grab --enable-bzlib --enable-zlib --enable-shared
>>> --enable-static --disable-debug --arch=x86_64 --enable-pic
>>> --extra-cflags='-I/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/include
>>> -DRUNTIME_CPUDETECT'
>>> --extra-ldflags='-L/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/lib64 -lssl
>>> -lcrypto -lz -lusb'
>>>    libavutil     50.15. 1 / 50.15. 1
>>>    libavcodec    52.73. 2 / 52.73. 2
>>>    libavformat   52.64. 2 / 52.64. 2
>>>    libavdevice   52. 2. 0 / 52. 2. 0
>>>    libavfilter    1.19. 0 /  1.19. 0
>>>    libswscale     0.11. 0 /  0.11. 0
>>>    libpostproc   51. 2. 0 / 51. 2. 0
>>> plughw:0,0: No such file or directory
>>>
>>>
>>> </snip>
>>>
>>> And I only removed the first -f for the audio device. I get the same
>>> error when I remove both -f parameters, although it doesn't make sense
>>> to me why I would not have them there anyway, and even if they were
>>> optional to specify, why it would be better not to?
>>>
>>>> _______________________________________________
>>>> ffmpeg-user mailing list
>>>> ffmpeg-user at ffmpeg.org
>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> - --
> Bradley D. Thornton
> Manager Network Services
> NorthTech Computer
> TEL: +1.760.666.2703  (US)
> TEL: +44.203.318.2755 (UK)
> http://NorthTech.US
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Find this cert at x-hkp://pool.sks-keyservers.net
>
> iQEcBAEBAwAGBQJN9eU5AAoJEE1wgkIhr9j38k0H/3ZhH6PQYhnxx1FnkKugZZrZ
> LNRYQ2f47/RWc5t4jfjYJjRXHFth2Xzb9EM9F0T/g4SvMOAAjn31eXQE7D02Eka4
> FFNCivG5juU42B1qAehlEG+E+SBauNj6T6taY5yfVnOLZwKAtD1qcLGXwCxI+dpS
> tIkg2PSfYNu7ZIkcWVxgC66WmTMQRuH4sKFXa6yyRszr42INIa/tVobahXrcRFg0
> DCFz7svpJW0fsZ3DmWhCvDZpPmCMRXgzB7+beof9rp8/J2wmte16TYYQXOcslBXa
> QV+H4L/KwJHT0K9G5lHg2MQt1cszAJHqz4ZqNLgxUnTbVdlvCza07pMCUwodH1E=
> =pjb0
> -----END PGP SIGNATURE-----
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

-- 
Bradley D. Thornton
Manager Network Services
NorthTech Computer
TEL: +1.760.666.2703  (US)
TEL: +44.203.318.2755 (UK)
http://NorthTech.US



More information about the ffmpeg-user mailing list