[Libav-user] Record black video with audio

Casey Price cprice1317 at gmail.com
Tue Jan 19 19:24:03 CET 2016


I'm currently trying to record a blank/black video with audio only from a
microphone in. The end goal is to have 1 video that's a recording of my
desktop with the left channel from a mic in as the audio, and another video
that's a black screen with only the right channel of the same mic in.  As
stupid as a 'blank video with audio' sounds, it does need to be a video and
not just a mp3/sound file due to customer restrictions with the software I
must use to play the file back. I'm using screen capture recorder for my
desktop capturing and have the desktop video with both channels of audio
working fine based off the transcoding.c example, but I'm having some
issues getting the blank video with audio video working.

I can record a blue video with audio from command line with the following

'ffmpeg -f lavfi -i color=c=blue:s=320x240 -f dshow -i
audo=virtual-audio-capturer output.mpg'

but I haven't been able to get my C code to work I just never get video and
the audio frames are always empty, I'm basing what I'm doing off the
transcoding.c example again, but unsure of a few things.

1. How do I handle handle 2 input formats? Do I need to use 2
AVFormatContext's (one for video and one for audio)? Or can I use 1 and
have the input format for the video and audio be different?
2. How do I only get the right channel of audio using the C API? Do I need
to use a filter? eg:

ffmpeg -f lavfi -i color=c=blue:s=320x240 -f dshow -i
qaudio='any-mic-device' -map_channel 1.0.1 output.mpg

current code: http://pastebin.com/ccagQvqs

I'm relatively new to C/C++ so any help/examples/direction would be greatly

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160119/060825a8/attachment.html>

More information about the Libav-user mailing list