Fedora Linux Support Community & Resources Center
  #1  
Old 27th December 2010, 03:03 AM
Doug Hutcheson Offline
Registered User
 
Join Date: Jun 2009
Location: Queensland
Posts: 271
linuxfedorafirefox
Which device to use for ffmpeg sound input? Fedora 14

I am trying to record a video clip, using my webcam, but sound synchronisation is always poor. I have used Cheese, UCView and VLC. One possible cause is explained in the reply to this question, but I am not an expert.

In desperation, I now want to try ffmpeg. The ffmpeg documentation gives the following example
Code:
ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
My system has no /dev/dsp, but does have /dev/snd with these files
Code:
$ ls /dev/snd
by-id  by-path  controlC0  controlC1  controlC29  hwC0D0  pcmC0D0c  pcmC0D0p  pcmC0D1p  pcmC1D0c  seq  timer
By running alsamixer, I have nutted out that controlC0 refers to the HDA Intel sound card, controlC1 is my USB webcam and controlC29 is the microphone built in to my notebook.

Using a reasonable guess for someone not used to the sound system, I tried this
Code:
$ ffmpeg -f oss -i /dev/snd/controlC29 -f video4linux2 -i /dev/video0 /tmp/out.mpg
FFmpeg version SVN-r24044, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jul 21 2010 15:03:32 with gcc 4.5.0 20100716 (Red Hat 4.5.0-3)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --extra-version=rpmfusion --enable-bzlib --enable-libdc1394 --enable-libdirac --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avfilter-lavf --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil     50.20. 0 / 50.20. 0
  libavcodec    52.79. 1 / 52.79. 1
  libavformat   52.73. 0 / 52.73. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.20. 1 /  1.20. 1
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[oss @ 0x13a46c0] Soundcard does not support 16 bit sample format
/dev/snd/controlC29: Input/output error
After a couple of other attempts, I tried dropping the '-f oss' parameter and saw
Code:
$ ffmpeg -i /dev/snd/controlC29 -f video4linux2 -i /dev/video0 /tmp/out.mpg
<snip>
/dev/snd/controlC29: Operation not permitted
Attempting to use alsa resulted in
Code:
$ ffmpeg -f alsa -i /dev/snd/controlC29 -f video4linux2 -i /dev/video0 /tmp/out.mpg
FFmpeg version SVN-r24044, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jul 21 2010 15:03:32 with gcc 4.5.0 20100716 (Red Hat 4.5.0-3)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --extra-version=rpmfusion --enable-bzlib --enable-libdc1394 --enable-libdirac --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avfilter-lavf --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil     50.20. 0 / 50.20. 0
  libavcodec    52.79. 1 / 52.79. 1
  libavformat   52.73. 0 / 52.73. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.20. 1 /  1.20. 1
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM /dev/snd/controlC29
[alsa @ 0x14c46c0] cannot open audio device /dev/snd/controlC29 (No such file or directory)
/dev/snd/controlC29: Input/output error
I am unwilling to blindly edit the file /etc/modprobe.d/dist-oss.conf because it warns
Code:
# OSS Sound Support
# This has been disabled in F11 onwards because it can interfere with the
# PulseAudio sound service (a legacy OSS application can prevent PulseAudio
# applications from playing sound by preventing PulseAudio from (re-)opening
# the sound device). To re-enable support, uncomment the following line:
I think my question boils down to "How do I record a video clip on Fedora 14 using ffmpeg?", but I am specifically interested in knowing how to specify a sound input device for my system.

Cheers, Doug

Last edited by Doug Hutcheson; 27th December 2010 at 05:46 AM. Reason: Tried using alsa, examined /etc/modprobe.d/dist-oss.conf
Reply With Quote
  #2  
Old 29th December 2010, 06:23 AM
Doug Hutcheson Offline
Registered User
 
Join Date: Jun 2009
Location: Queensland
Posts: 271
linuxfedorafirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

ffmpeg is expecting alsa devices in the format "default" or "hw:0,0". On my system, I started to get partial results using commands of the form
Code:
$ ffmpeg -t 10 -f video4linux2 -r 30 -i /dev/video0 -f alsa -ac 2 -i hw:1,0 webcam.mp4
I still get no sound, but at least the device is being recognised. A more helpful error message might help, but at least I am making progress now.
Reply With Quote
  #3  
Old 29th December 2010, 05:29 PM
oldcpu Offline
Registered User
 
Join Date: Jan 2009
Location: Europe
Posts: 241
linuxsusefirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by Doug Hutcheson View Post
ffmpeg is expecting alsa devices in the format "default" or "hw:0,0". On my system, I started to get partial results using commands of the form
Code:
$ ffmpeg -t 10 -f video4linux2 -r 30 -i /dev/video0 -f alsa -ac 2 -i hw:1,0 webcam.mp4
I still get no sound, but at least the device is being recognised. A more helpful error message might help, but at least I am making progress now.
This thread was marked as SOLVED, but I can't tell if you solved the issue of audio being desync'd from the video.

I found this works for me:
Code:
ffmpeg -f alsa -ac 2 -i hw:1,0 -itsoffset 00:00:00.5 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 out.mpg
where I am using "itsoffset 00:00:00.5" to offset the audio by 1/2 second. Note the format of that offset is HH:MM:SS.s

I found 1/2 second was typical after some iterative recording attempts. You need to find what works for you. ...

Last edited by oldcpu; 29th December 2010 at 07:29 PM.
Reply With Quote
  #4  
Old 29th December 2010, 11:58 PM
Doug Hutcheson Offline
Registered User
 
Join Date: Jun 2009
Location: Queensland
Posts: 271
linuxfedorafirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by oldcpu View Post
I found this works for me:
Code:
ffmpeg -f alsa -ac 2 -i hw:1,0 -itsoffset 00:00:00.5 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 out.mpg
Thats very interesting. Your command string on my system recorded valid video, but no audio. I adjusted the device and channels settings to try both internal and usb mics, without success. I will keep trying tweaks, to see if I can beat ffmpeg into submission. VLC is now doing a good job, so it is not a system issue. See my last post in this thread, to see what I have working and this thread for more info from the VLC forums. From links I followed there, it sounds as though the synch problems are buried somewhere in the driver layer, which is way beyond my skill level to solve. I will try to get the developers together, to see if they can sort it out.


Thanks very much for your post.

Doug
Reply With Quote
  #5  
Old 30th December 2010, 09:01 AM
oldcpu Offline
Registered User
 
Join Date: Jan 2009
Location: Europe
Posts: 241
linuxsusefirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by Doug Hutcheson View Post
Thats very interesting. Your command string on my system recorded valid video, but no audio.
Sorry to read it did not work. As a quality check, what is your mic's hardware device/sub-device id ? (not sure if my terminology is correct).

On my PC if I type:
Code:
arecord -l
I get:
Code:
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
  Subdevices: 3/3
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
card 1: U0x46d0x821 [USB Device 0x46d:0x821], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
From which you can see my Webcam (a USB device) is card-1. It has only one subdevice, which is #0. From that I concluded my webcam was " hw:1,0 " ie where the "1" corresponds to the sound card, and the "0" to the subdevice.

As a quality check, is "hw:1,0" the correct setting for your webcam ?

Note also, I'm a KDE user, so I had to go into kmix and unmute my USB (webcam) mic and move up the capture levels. You can see that from my mixer settings for the webcam:

Code:
!!-------Mixer controls for card 1 [U0x46d0x821]

Card hw:1 'U0x46d0x821'/'USB Device 0x46d:0x821 at usb-0000:00:1d.7-2, high speed'
  Mixer name	: 'USB Mixer'
  Components	: 'USB046d:0821'
  Controls      : 2
  Simple ctrls  : 1
Simple mixer control 'Mic',0
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined
  Capture channels: Mono
  Limits: Capture 0 - 52
  Mono: Capture 47 [90%] [-24.00dB] [on]
I obtained those settings from the output of the diagnostic script:
Code:
/usr/sbin/alsa-info.sh --no-upload


---------- Post added at 10:01 AM ---------- Previous post was at 09:57 AM ----------

Quote:
Originally Posted by oldcpu View Post
I obtained those settings from the output of the diagnostic script:
Code:
/usr/sbin/alsa-info.sh --no-upload
Actually, given my mic is card 1, I could have obtained the same by typing:

Code:
amixer -c 1
which gives:

Code:
Simple mixer control 'Mic',0
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined
  Capture channels: Mono
  Limits: Capture 0 - 52
  Mono: Capture 47 [90%] [-24.00dB] [on]
Reply With Quote
  #6  
Old 30th December 2010, 09:15 AM
Doug Hutcheson Offline
Registered User
 
Join Date: Jun 2009
Location: Queensland
Posts: 271
linuxfedorafirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by oldcpu View Post
Sorry to read it did not work. As a quality check, what is your mic's hardware device/sub-device id ? (not sure if my terminology is correct).
Depends on the order the modules load, but generally hw:0,0 is the internal card and hw:1,0 is the usb mic. The internal card has a jack input and on onboard mic, the choice of which is selected using System/Sound/Input. Tried all three devices without luck.

Cheers,
Doug
Reply With Quote
  #7  
Old 30th December 2010, 11:18 AM
oldcpu Offline
Registered User
 
Join Date: Jan 2009
Location: Europe
Posts: 241
linuxsusefirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by Doug Hutcheson View Post
Depends on the order the modules load, but generally hw:0,0 is the internal card and hw:1,0 is the usb mic. The internal card has a jack input and on onboard mic, the choice of which is selected using System/Sound/Input. Tried all three devices without luck.
Did you double check your mixer for hw:1,0 ? ... Also, when you tried hw:0,0, did you have your external mic plugged in to test it (and also tuned the mixer for it) ?

It was only after reading your initial posts that I saw the application of the "alsa" option in the ffmpeg command, and I guess I'm somewhat surprised that hw:1,0 did not work for you (since its kind of neat that it works for myself). But I note 'oss' with /dev/dsp also works for me in the ffmpeg command for my external (jack) mic.

---------- Post added at 12:18 PM ---------- Previous post was at 10:24 AM ----------

Quote:
Originally Posted by Doug Hutcheson View Post
I am trying to record a video clip, using my webcam, but sound synchronisation is always poor.
Getting back to your original post, while not directly solving the problem, there is a work around where after recording the video with audio, you can often resync the audio to the video using avidemux.

For example, if I were to have used the ffmpeg command to record a video with audio from my webcam using the .mpg format, I could resync with avidemux by applying these settings (assuming I needed a 150 msec offset):



Followed by a simple File > Save > Save Video
Reply With Quote
  #8  
Old 31st December 2010, 03:41 AM
Doug Hutcheson Offline
Registered User
 
Join Date: Jun 2009
Location: Queensland
Posts: 271
linuxfedorafirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by oldcpu View Post
Did you double check your mixer for hw:1,0 ? ... Also, when you tried hw:0,0, did you have your external mic plugged in to test it (and also tuned the mixer for it) ?
Yes, I tried hw:0,0 with both the onboard mic and the external one, and hw:1,0 with the usb mic (that was the way the modules had loaded), selecting the appropriate device using the System/Preferences/Sound mixer and plugging/unplugging as appropriate.
Quote:
Originally Posted by oldcpu View Post
I note 'oss' with /dev/dsp also works for me in the ffmpeg command for my external (jack) mic.
Interesting. I don't load the oss module, as the conf file has a warning about possible problems with legacy oss apps. I figured out that the equivalent to /dev/dsp under alsa is /dev/snd/pcmC0D0c (card zero, device zero, capture) and, similarly, ~C1D0c for the other device (usually my webcam). However, ffmpeg did not understand /dev/snd/pcmC0D0c, returning an error that the file did not exist. That really had me baffled, until another thread elsewhere made me wonder if hw:0,0 etc. would work and hey, presto!
Quote:
Originally Posted by oldcpu View Post
there is a work around where after recording the video with audio, you can often resync the audio to the video using avidemux.
Thanks very much for posting this trick. I have not been able to get avidemux to recognise any of the formats I have so far tried, using VLC, Cheese, UCView and ffmpeg, possibly an artefact of running on an x86_64 box. Your post has prompted me to try to get avidemux working and I will gladly try your method. My observation of what has partly worked so far is that the sound/video synch can 'drift', starting close and ending out of synch after some minutes. By setting VLC to allow real-time priority, I think I have solved the drift problem and your info re avidemux may allow me to fix any remaining synch issue.

Thanks so much for sticking with this - I may get it working yet!

Cheers,
Doug

Late news: avidemux does work on my system, with the following caveats:
1. Some of the formats recorded by various tools cause it to crash with a seg fault.
2. Some of the clips recorded by various tools just plain don't open - just get a "can't open file" complaint.
It does open some of my clips. Sadly, the .avi files saved by VLC in record mode can't be opened and they are the closest I got to correctly synched audio. I will try getting VLC to convert them to another format and try again. At least I know avidemux does work, at least.

Happy New Year.

Last edited by Doug Hutcheson; 31st December 2010 at 05:44 AM. Reason: Got avidemux working - kinda
Reply With Quote
  #9  
Old 31st December 2010, 09:08 AM
oldcpu Offline
Registered User
 
Join Date: Jan 2009
Location: Europe
Posts: 241
linuxsusefirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by Doug Hutcheson View Post
Late news: avidemux does work on my system, with the following caveats:
1. Some of the formats recorded by various tools cause it to crash with a seg fault.
2. Some of the clips recorded by various tools just plain don't open - just get a "can't open file" complaint.
It does open some of my clips. Sadly, the .avi files saved by VLC in record mode can't be opened and they are the closest I got to correctly synched audio. I will try getting VLC to convert them to another format and try again. At least I know avidemux does work, at least.
Reference tuning avidemux (if you were to also try than in addition to vlc) there is an avidemux forum here: http://avidemux.org/admForum/

Its possible there may be some suggestions there how to better tune/timeshift the audio to the video on any webcam captured media files that you have created.

---------- Post added at 09:43 AM ---------- Previous post was at 09:25 AM ----------

Quote:
Originally Posted by Doug Hutcheson View Post
Interesting. I don't load the oss module, as the conf file has a warning about possible problems with legacy oss apps. I figured out that the equivalent to /dev/dsp under alsa is /dev/snd/pcmC0D0c (card zero, device zero, capture) and, similarly, ~C1D0c for the other device (usually my webcam). However, ffmpeg did not understand /dev/snd/pcmC0D0c, returning an error that the file did not exist. That really had me baffled, until another thread elsewhere made me wonder if hw:0,0 etc. would work and hey, presto!
Hmm ... yet you get no capture from ffmpeg when you specify hw:0,0 nor hw:1,0 with alsa specified. That is puzzling.

Its a mute point (because you do not have OSS enabled) but I note I have OSS working with my external mic in two different ways with ffmpeg:

Code:
ffmpeg -f oss -i /dev/dsp -itsoffset 00:00:00.5 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 out.mpg
and also:

Code:
ffmpeg -f oss -i /dev/audio -itsoffset 00:00:00.5 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 out.mpg


---------- Post added at 10:08 AM ---------- Previous post was at 09:43 AM ----------

Quote:
Originally Posted by Doug Hutcheson View Post
I am trying to record a video clip, using my webcam, but sound synchronisation is always poor. I have used Cheese, UCView and VLC. One possible cause is explained in the reply to this question, but I am not an expert.

In desperation, I now want to try ffmpeg.
I'm very sensitive to the fact that you noted in the subject line, and in the text of your message, that you wanted to use ffmpeg. And while it works for me, it does not work for you, and we have been struggling here with not much success.

I note you did also say you tried Cheese, UCView and VLC and hence it makes me think you may be open to ideas OTHER than ffmpeg. Did you try mencoder ?

How about something like this:

Code:
mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:immediatemode=0:alsa:adevice=hw.1,0 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi
That works for me for my webcam.

Last edited by oldcpu; 31st December 2010 at 08:51 AM.
Reply With Quote
  #10  
Old 2nd January 2011, 05:39 AM
Doug Hutcheson Offline
Registered User
 
Join Date: Jun 2009
Location: Queensland
Posts: 271
linuxfedorafirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by oldcpu View Post
there is an avidemux forum here: http://avidemux.org/admForum/
Thanks for that - I will go over there and see if I can sort it out.
Quote:
Originally Posted by oldcpu View Post
I note I have OSS working with my external mic in two different ways with ffmpeg
I will try enabling the oss modules and test your suggestions
Quote:
Originally Posted by oldcpu View Post
you wanted to use ffmpeg
Only as an alternative to the tools that were not working properly. I have always understood ffmpeg to be the power-user's option, so it seemed sensible to try it, but I am anything but a power user when it comes to a/v, hence the cry for help.
Quote:
Originally Posted by oldcpu View Post
Did you try mencoder ?
No, I had not tried mencoder, for the same reason that I am (for now) out of my depth with command-line tools for recording a/v. I tried it just now and got an error:
Code:
$ mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:immediatemode=0:alsa:adevice=hw.1,0 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi
MEncoder SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
success: format: 9  data: 0x0 - 0x0
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: USB Camera (046d:08d9)
 Capabilites:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = zc3xx;
 Current input: 0
 Current format: unknown (0x4745504a)
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: Cannot get fps
Channel count not available - reverting to default: 1
Channel count not available - reverting to default: 1
Floating point exception (core dumped)
To my inexperienced eye, this seems to be saying v4l2 is not driving the mic using hw.1,0, so I tried specifying 'default' ,with the same result. For completeness, I also tried /dev/snd/pcmC0D0c and got the dreaded message:
Code:
...
<messages snipped>
...
v4l2: Cannot get fps
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM /dev/snd/pcmC0D0c
Error opening audio: No such file or directory
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM /dev/snd/pcmC0D0c
Error opening audio: No such file or directory
ALSA lib pcm.c:2211:(snd_pcm_open_noupdate) Unknown PCM /dev/snd/pcmC0D0c
Error opening audio: No such file or directory
v4l2: ioctl set mute failed: Invalid argument
v4l2: 0 frames successfully processed, 0 frames dropped.
============ Sorry, this file format is not recognized/supported =============
=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===
Cannot open demuxer.

Exiting...
I will try loading the oss modules and see if I get different results using your suggested ffmpeg command above.

All I really want is to find some tool which will record synchronised sound and video, using my kit. As the wise man said "When you are up to your backside in alligators, it is hard to remember you are here to drain the swamp".

I really appreciate your helpful posts here and will try your suggestions later today.

Cheers,
Doug

---------- Post added at 12:35 PM ---------- Previous post was at 10:39 AM ----------

Quote:
Originally Posted by oldcpu View Post
Code:
ffmpeg -f oss -i /dev/dsp -itsoffset 00:00:00.5 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 out.mpg
and also:

Code:
ffmpeg -f oss -i /dev/audio -itsoffset 00:00:00.5 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 out.mpg
"Velly intelisting", said the man with no r's Booting with the oss drivers enabled allows your suggestions to work. Both /dev/dsp and /dev/audio captured sound. Sadly, with or without the -itoffset, sound was badly out of synch. At least I have a partial success and will now hammer away trying different delays, to see if I can strike gold.

I will have to keep one eye on my other multimedia apps, to see if they have problems with the oss module.

---------- Post added at 12:48 PM ---------- Previous post was at 12:35 PM ----------

Quote:
Originally Posted by Doug Hutcheson View Post
Booting with the oss drivers enabled allows your suggestions to work. Both /dev/dsp and /dev/audio captured sound.
Well, I'll be ...! Whether it is coincidence or not, ffmpeg is now recording sound using alsa and device 'default', 'hw:0,0' and 'hw:1,0'. Synchro is still a problem, but I have something to work with and will, no doubt, find the solution.

Cheers, Doug

---------- Post added at 01:29 PM ---------- Previous post was at 12:48 PM ----------

Quote:
Originally Posted by Doug Hutcheson View Post
ffmpeg is now recording sound using alsa and device 'default', 'hw:0,0' and 'hw:1,0'.
Now working happily without oss modules loaded! Was not working last time I tried. Sigh. I love computers ... not!

---------- Post added at 03:39 PM ---------- Previous post was at 01:29 PM ----------

Quote:
Originally Posted by Doug Hutcheson View Post
Now working happily
In addition, I have got VLC working for recording, by clearing a sound delay I had set earlier in my experimentation see my last entry in this thread. Stupid mistake, now fixed.

I will keep trying to get ffmpeg sorted out just for my own satisfaction, but the urgency is over.

Thanks for all the competent help.

Last edited by Doug Hutcheson; 2nd January 2011 at 05:43 AM.
Reply With Quote
  #11  
Old 2nd January 2011, 02:32 PM
oldcpu Offline
Registered User
 
Join Date: Jan 2009
Location: Europe
Posts: 241
linuxfirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by Doug Hutcheson View Post
No, I had not tried mencoder, for the same reason that I am (for now) out of my depth with command-line tools for recording a/v. I tried it just now and got an error:
Code:
$ mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:immediatemode=0:alsa:adevice=hw.1,0 -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi
MEncoder SVN-r31628-4.4.4 (C) 2000-2010 MPlayer Team
success: format: 9  data: 0x0 - 0x0
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: USB Camera (046d:08d9)
 Capabilites:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = zc3xx;
 Current input: 0
 Current format: unknown (0x4745504a)
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: Cannot get fps
Channel count not available - reverting to default: 1
Channel count not available - reverting to default: 1
Floating point exception (core dumped)
To my inexperienced eye, this seems to be saying v4l2 is not driving the mic using hw.1,0,
I can't tell, ... I note it could not find the fps (frames per second) so maybe you could specify the Frames per second (FPS).

I find mencoder renders a slightly better video than ffmpeg at 640x480 resolution.


Quote:
Originally Posted by Doug Hutcheson View Post
Well, I'll be ...! Whether it is coincidence or not, ffmpeg is now recording sound using alsa and device 'default', 'hw:0,0' and 'hw:1,0'. Synchro is still a problem, but I have something to work with and will, no doubt, find the solution.
Keep trying different values for the -itsoffset HH:MM:SS.s entry in ffmpeg, and eventually you will find an optimal one. I did note an ffmpeg bug, that if one does not delete the old ffmpeg output video file, the option to write over the old one does not work well. So delete the old file before you run the ffmpeg command line again.

Its looking like this thread is now much closer to being actually solved ! Good news!

---------- Post added at 03:32 PM ---------- Previous post was at 02:04 PM ----------

Quote:
Originally Posted by oldcpu View Post
Keep trying different values for the -itsoffset HH:MM:SS.s entry in ffmpeg, and eventually you will find an optimal one.
Its possible -itsoffset does not work with all encoded output of ffmpeg. I note you were trying the mp4 out. I'm not certain " itsetoffset " works with that encoding.
Reply With Quote
  #12  
Old 3rd January 2011, 01:24 AM
Doug Hutcheson Offline
Registered User
 
Join Date: Jun 2009
Location: Queensland
Posts: 271
linuxfedorafirefox
Re: Which device to use for ffmpeg sound input? Fedora 14

Quote:
Originally Posted by oldcpu View Post
I find mencoder renders a slightly better video than ffmpeg at 640x480 resolution.
Everything I tried with mencoder came back with "Floating point exception (core dumped)".

I have cracked ffmpeg! This works for me
Code:
$ ffmpeg -f alsa -i default -itsoffset 00:00:01.2 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 out.mpg
I don't know if deleting the target first makes the difference, but I am doing so every time now.

Thanks very much for your help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
No sound input device zkab Using Fedora 2 6th December 2010 09:42 AM
Need Fedora to remember audio input device Sugarat Using Fedora 4 2nd May 2010 03:21 PM
Disable input device for X Frank Lorenz Using Fedora 8 28th April 2010 01:39 AM
k9copy. No input device shad0wx Using Fedora 4 20th September 2008 11:47 AM
Input Device anv Hardware & Laptops 1 3rd August 2006 06:48 PM


Current GMT-time: 22:48 (Monday, 29-05-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat