User avatar
aumolac
Posts: 43
Joined: Mon Jul 01, 2013 7:41 pm
Location: Croatia
Contact: Website

Raspberry pi camera and sound card

Tue May 20, 2014 2:44 pm

Hello there,

I'm trying to make a program that can capture video fom camera and audio from USB (or wolfson, that would be nice) sound card.
What I'm trying to accomplish in this program is that when video and sound is captured, the output file is .mp4 extension (or some other, like .ogv), with video and sound. I know how to capture video from raspberry pi camera, and I know how to capture sound through ALSA, but my problem is encoder. Can somebody help me with that? Thanks.
Imagination is more important than knowledge.
-A. Einstein-

suicidal_orange
Posts: 217
Joined: Sun Mar 16, 2014 10:56 am

Re: Raspberry pi camera and sound card

Tue May 20, 2014 5:49 pm

I know a little about video editing in Linux and I have a Wolfson and Pi a camera, but I don't know how to use the camera - that was my next project...

I will have a go tonight and let you know how it goes, it's not as easy as I first thought :(

Edit: Found a single command that works for 640x480 at about 12fps (found this last, not experimented with options)

Code: Select all

avconv -f alsa -i hw:0 -f video4linux2 -i /dev/video0 out.mpg
but if I pipe raspivid to avconv (should be better as hardware accelerated) it works with sped-up video, but adding sound results in it complaining about missing framerate option.

Code: Select all

raspivid -fps 25 -o - -h 600 -w 800 -t 20000 | avconv -re -i pipe: -r 25  -c:v copy -c:a aac -strict experimental silenttest.mp4 -framerate 25 #sped up

raspivid -fps 25 -o - -h 480 -w 640  | avconv -re -i pipe: -r 25  -c:v copy -framerate 25 -f alsa -ac 2 -i hw:0,0 -acodec mp3 -b 128k nonsilenttest.mp4 #complains about missing framerate
More work to be done but it's possible :)

Wonderjacky
Posts: 3
Joined: Wed Jan 16, 2013 11:09 pm

Re: Raspberry pi camera and sound card

Mon Aug 18, 2014 9:36 pm

Hello,

I try to do the same thing, i.e, mixing the video from the campi and the audio from a usb mic.

The following is working OK (I mean this is doing what I expected : it mixes the "live audio" with the video recorded inside the file video.h264)

Code: Select all

raspivid -o video.h264 -t 30000 -w 640 -h 360 -fps 25
avconv -i video.h264 -f alsa -ac 1 -i hw:1,0 -vcodec copy -acodec aac -ar 48000 -strict -2 test.flv
Now if I want to mix the "live audio" and "live video", I do the following

Code: Select all

raspivid -t 0 -w 640 -h 360 -fps 25 -o - | avconv -i - -f alsa -ac 1 -i hw:1,0 -vcodec copy -acodec aac -ar 48000 -strict -2 test3.flv
But the resulted file is not working.
The file is quite big but if I tried to open it with vlc, I see only 1 frame and I have a error message.

I don't see any error message in the console.

Can anyone please help me? Does anyone succeeded in doing this?

XB32Z
Posts: 7
Joined: Thu Jul 23, 2015 11:27 am

Re: Raspberry pi camera and sound card

Thu Jul 23, 2015 1:14 pm

Hi did you finally find an answer ? I'm trying to do the same here but it seems so complex for such a basic action !

User avatar
aumolac
Posts: 43
Joined: Mon Jul 01, 2013 7:41 pm
Location: Croatia
Contact: Website

Re: Raspberry pi camera and sound card

Thu Jul 23, 2015 2:13 pm

Well, I was off for a longer time, so I didn't. But I'm still searching.
Imagination is more important than knowledge.
-A. Einstein-

User avatar
aumolac
Posts: 43
Joined: Mon Jul 01, 2013 7:41 pm
Location: Croatia
Contact: Website

Re: Raspberry pi camera and sound card

Wed Jul 29, 2015 1:12 am

I think I've found an answer.
I'm going to check it tomorrow, and then, post if it works. :)
Imagination is more important than knowledge.
-A. Einstein-

Robrother
Posts: 1
Joined: Fri Oct 02, 2015 6:35 pm

Re: Raspberry pi camera and sound card

Fri Oct 02, 2015 6:41 pm

Hello,

Did you find the answer? Because I´m trying to do the same project, and I couldn´t mix the audio and video at the same time. Somebody could help me?

Best regards.

User avatar
aumolac
Posts: 43
Joined: Mon Jul 01, 2013 7:41 pm
Location: Croatia
Contact: Website

Re: Raspberry pi camera and sound card

Fri Oct 02, 2015 10:15 pm

Well, I've got a minor problem here. It's about syncing, but I should solve it soon. Sorry for later response, but I was literally busy with a lot of other things...
Imagination is more important than knowledge.
-A. Einstein-

ladyquestio
Posts: 3
Joined: Wed Jun 17, 2015 5:18 pm

Re: Raspberry pi camera and sound card

Fri Jun 10, 2016 6:18 pm

Did you ever get this to work? If so please post information . I am also trying to do this very thing .
Thank You .

Return to “Graphics, sound and multimedia”

Who is online

Users browsing this forum: No registered users and 5 guests