yes, libavformat and libavcodec will work for that.<div><br></div><div>in general...</div><div><br></div><div>inFormat = avformat_open_input(...);</div><div>outFormat = avformat_alloc_context(...);</div><div><br></div><div>
for each input stream () {</div><div> avcodec_find_decoder();</div><div> avcodec_find_encoder();</div><div> avcodec_open(outFormat);</div><div> avcodec_open(inFormat);</div><div>}</div><div><br></div><div>avio_open(outFormat->pb);</div>
<div>av_write_header(outFormat);</div><div><br></div><div>while (1) {</div><div> frame = av_read_frame();</div><div> if (you need to change codec or modify the video somehow) {</div><div> if (frame is video) {</div>
<div> decodedFrame = avcodec_decode_video2(frame);</div><div> encodedFrame = avcodec_encode_video(decodedFrame);</div><div> writeframe(encodedFrame);</div><div> } else if (frame is audio) {</div>
<div> decodedFrame = avcodec_decode_audio3(frame);</div><div> encodedFrame = avcodec_encode_audio(encodedFrame);</div><div> writeframe(encodedFrame);</div><div> }</div><div> } else {</div>
<div> av_write_frame(frame);</div><div> }</div><div>}</div><div><br></div><div>av_close_input_file(inFormat);</div><div>avio_close(outFormat);</div><div><br></div><div><br>--luke</div><div><br><div class="gmail_quote">
On Tue, Jan 24, 2012 at 4:43 PM, Ognen Duzlevski <span dir="ltr"><<a href="mailto:ognen.duzlevski@gmail.com">ognen.duzlevski@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<div><br></div><div>I am just beginning to dabble with video and sound programming on Linux. For starters I just want to make a simple program to grab a video from a webcam and record it. Can ffmpeg be used for this? Where do I find documentation on the API involved and, in general, where do I start? :)</div>
<div><br></div><div>Thanks!</div><span class="HOEnZb"><font color="#888888"><div>OD<br clear="all"><div><br></div>-- <br><div><span style="color:rgb(136,136,136);font-style:italic;font-size:14px;font-family:verdana,geneva,lucida,'lucida grande',arial,helvetica,sans-serif">"Before you start searching for happiness, think about it - maybe you are already happy? Happiness is common, often invisible and many people usually can't see it." -- Dusko Radovic</span></div>
<br>
</div>
</font></span><br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>-<br>-<br>-<br>-<br>Luke Clemens<br><a href="http://clemens.bytehammer.com">http://clemens.bytehammer.com</a><br>
</div>