ffmpeg - You can have Sound, or Video - but not both - Must I choose between them?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
ffmpeg - You can have Sound, or Video - but not both - Must I choose between them?
I am unable to screencast with sound and video with ffmpeg
I can record sound. I can record video - but if I try to do both I only get video.
All I want to do is upload a few tuts to vimeo or youtube, mostly shell stuff in xterm, or some config/install demonstrations on the desktop.
I can do this with recordmydesktop no problem, except for the video quality.
This has apparently stumped the developers or those who are in #ffmpeg, I've been patiently waiting and asking there for a couple of days now.
And on the ffmpeg-users email list, the only response to date was by someone who suggested I leave out the -f which I was pretty sure would only result in an error condition - which is did.
Most everything regarding this problem that I've gone through so far is pasted at this link:
I get sound when I do this:
ffmpeg -f alsa -i plughw:0 alsaout.wav
Quote:
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
You let ffmpeg set the codec to use on the first example, just by specifying a file extension .wav
You told it to use pcm_s16 on the second. That sounds like it would be the same. Not necessarily. Neither one of those is a raw audio dump I don't think.
Have you tried other audio codecs? Play a little .flv or video that you have and capture it.
ffmpeg won't capture the audio if you don't launch it first, and then start using the sound device on some machines.
As for oss.
You don't say if you specified an oss device like,
Code:
ffmpeg -f oss -i /dev/dsp0........
The reason I say that is if you specify the correct device to use, you get the sound if the right mixer control is turned up.
Then there is also alsamixer. Depends on your sound card. Just because you can hear the sound playing does not mean ffmpeg will get it if the correct mixer is not turned up, or muted. I have an Arch box that I worked with for a couple of hours. Could not get ffmpeg to capture the sound....turned out it was a lack of enabling one of the items in alsamixer.
If your sound card will play your media, or you can hear yourself talking through your sound card on your mic, then ffmpeg should be able to grab it.
Or maybe you found some kind of bug with your version of ffmpeg, your sound module, alsamixer etc.
You told it to use pcm_s16 on the second. That sounds like it would be the same. Not necessarily. Neither one of those is a raw audio dump I don't think.
Okay we're getting somewhere now
I'll probably quote you more later, as I had put this on the back burner for a while.
But I came back and did a cut and past, your second and third pastes actually worked the third one, I had to change it out for libmp3lame.
Okay so here's what works so far (which gives me a starting point) and I'll follow it up with a discussion of what doesn't...
Basically, the trend coming on here is, that anything above 400x600 has no audio - which is really bizarre to me. my resolution is 1440x900 too, which makes it a little more annoying, although I could just be interested in capturing a single xterm window for most of what i wanted to do along with my audio.
It's almost as if, I have a few straws too many for the camel, who goes on strike after a certain load.
To answer your questions, I don't have pulse, and oss and dsp come up with errors so I think it's strictly alsa and plughw I'm going to be working with on this laptop (plain old hw:0 doesn't give an error, but doesn't seem to work either, so plughw:0 does).
But at least it's a starting point, and I don't know if the *400* was a typo or not on your part, but therein lies at least part of the key to this problem.
For all your help so far, thank you so much
EDIT: I should note that no matter what, I ALWAYS get the message:
Code:
[alsa @ 0x63a4f0]ALSA buffer xrun.
And here's a copy of some of the data from the last session that worked with audio and video, if this helps much:
Do you ever have gkrellm or top running when you are capturing?
If you are pegging the CPU at 100% then that could explain why something gets lost. You should be able to capture 800x600 with sound on a modern machine though. You'll have to keep the cpu at les than 100% or you'll get jerky video or maybe lost sound.
You could lower the video bit rate, try changing the audio bit rate too.
Instead of video at 1000K lower it. Instead of audio at 128k, lower it.
If you are just trying to capture and xterm while you narrate what you are doing then 32kb audio and 300k video may suffice. I have also had better luck with a greater framerate than 30.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.