return to I Love My Journal
A Little Closer to Center...
Musings about Life, Linux, and Latter-day Saints.
Pages
About Me
Links


Tags
PERSONAL 520
SPIRITUAL 416
LDS 312
BOOK OF MORMON 237
SCRIPTURES 154
STUDIO-JOURNEY 129
RELIGION 112
LINUX 79
COMPUTERS 65
LIFE 60
GENERAL CONFERENCE 46
GENTOO 39
MISCELLANEOUS 37
MUSIC 37
PROGRAMMING 33
CARS 29
MICROSOFT 23
FAMILY 23
AUDIO 21
I LOVE MY JOURNAL 18
FUN 15
CHILDREN 12
CURRENT EVENTS 10
NATURE'S WAY 10
VIDEO 9
DRM 9
CONEXM 7
BABBLINGS 7
PROVO CITY CENTER TEMPLE 6
FRIENDS 6
HEROD THE FINK 5
GAMES 5
COMPUTER HARDWARE 5
DRUMS 4
HAND OF GOD 3
ADVERSITY 3
KDENLIVE 3
AUDIO HARDWARE 3
GENERAL INSANITY 3
STUDIO 3
THANKS4GIVING 2
CATS 2
MY JOURNAL 1
POETRY 1
FOREVERGREEN 1
EVERYDAY THOUGHTS 1
GOSPEL 1
PARENTING 1
YOUTH CONFERENCE 1
CHURCH NOTES 1
POLITICS 1


RSS Feed

RSS FeedSubscribe!
Tue - May 20, 2008 : 06:50 pm
excited
   rated 7 times
>>next>>
<<previous<<
FFmpeg Webcam Video in Linux
Okay...  I've been wondering how to do this for quite some time, and I finally figured it out with the help of this mailing list thread.

I've always thought ffmpeg was a pretty amazing program, but now, I will build a shrine to it and worship it weekly.

Ffmpeg is the program which allows me to create a video with sound in Linux.

I have a Logitch Orbit AF webcam, and with the following command, it records both video and audio.

ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 -f audio_device -ac 2 -i /dev/dsp1 -f mp4 Filename.mp4

and the file "Filename.mp4" will be created and stored in the current working directory.

Great stuff!

After trying to get this video to work with flowplayer (flowplayer.org), it would reproduce the audio, but not the video, so in order to get it to work (albeit pretty low quality), I had to convert the m4v file to an flv file with the following command:

ffmpeg -i input_file_name.mp4 -vcodec flv -ar 22050 output_file_name.flv

That seemed to do the trick.  Here's the first video recorded using this method.

PS - Even though my camera is v4l2, I had to enable the v4l USE flag. Make sure you have the v4l USE flag turned on when you emerge it, or it won't work.

Go gentoo!
Comment by PoeticIntensity on Jun. 03, 2008 @ 12:41 am
I figured out the optimal settings for ffmpeg as far as encoding videos for this journal goes.  Here is the setting:

ffmpeg -i input_filename.avi -f flv -b 700k -r 29.97 -ar 22050 -s 450x338 output_filename.flv

Hope that helps someone.
Comment by Juan on Sep. 17, 2008 @ 03:42 pm
Thanks for the ffmpeg command lines!

They worked perfectly with my cheap usb webcam
Comment by Nick on Oct. 09, 2010 @ 03:47 am
Have you figured out how to do video streaming from the iphone camera? If so, could you share that with me?

thanks

Nick
Comment by Frank on Aug. 01, 2011 @ 02:14 am
ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 -f alsa -ac 1 -i default -f mp4 Filename.mp4

Did it for me on Debian Squeeze using alsa rather than oss.  It ignored -ac 1 making the sound 2 channels.  I had to use pavucontrol to switch sound to the webcam microphone, you have to do this when the ffmpeg command is running.  Incidentally, good show, you've saved me a lot of effort.