<div dir="ltr"><div>This might be what you are looking for:<br></div>AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c);<div><br></div><div>Specify the correct codec when adding streams to the AVFormatContext created by avformat_alloc_output_context2().</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 7, 2021 at 11:39 PM Mythili Vishalini Anbazhagan <<a href="mailto:manbazhagan27@gmail.com">manbazhagan27@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Hi, </span></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">I'm using ffmpeg libav library for live streaming via RTMP. I want to know how to give my choice of audio and video codec for the particular format in avformat_alloc_output_context2.</span></div><br>In Detail:<br>The following command works perfectly for me.<br>ffmpeg -re -stream_loop -1 -i ~/Downloads/Microsoft_Surface.mp4 -vcodec copy -c:a aac -b:a 160k -ar 44100 -strict -2 -f flv -flvflags no_duration_filesize rtmp://<a href="http://192.168.1.7/live/surface" target="_blank">192.168.1.7/live/surface</a><br>In the output, I have set my audio codec to be aac and copied the video codec from input, which is H264.<br>I want to emulate this in the library, but don't know how to.<br>avformat_alloc_output_context2, with parameter format name as "flv", sets oformat audio codec to ADPCM_SWF and video codec to FLV1. How to change that to AAC and H264 ?<br><br>So far, used av_guess_format to construct AVOutputFormat. It accepts only format as input. And I don't know where to mention audio and video codec.<br>Also tried giving filename to avformat_alloc_output_context2 with the rest of the parameters NULL. The file has AAC audio and H264 video. But still ffmpeg loads oformat with ADPCM_SWF audio and FLV1 video codecs.<br><br><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Any hint/guidance is hugely appreciated. Thank you.</span></div><br></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
</blockquote></div>