<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hello,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you so much again for the quick response.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">I'll check them.</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div><font face="trebuchet ms, sans-serif">Best Regards,</font></div><div><font face="trebuchet ms, sans-serif">Mythili</font></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 9, 2021 at 11:06 PM Guangyu Sun via Libav-user <<a href="mailto:libav-user@ffmpeg.org">libav-user@ffmpeg.org</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>Hi Mythili,</div><div><br></div>Check these two functions. Setting flvflags to the options should work.<div><br>int avformat_write_header(AVFormatContext *s, AVDictionary **options);<br>int avformat_init_output(AVFormatContext *s, AVDictionary **options);<br><div><br></div><div>Thanks,</div><div>Guangyu</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 8, 2021 at 9:46 PM Mythili Vishalini Anbazhagan <<a href="mailto:manbazhagan27@gmail.com" target="_blank">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">Hello,</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you so much for the information. I will try that and see.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I have found a workaround. Don't know if this is the correct way of doing this though.<br>Created AVOutputFormat using "<span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit">AVOutputFormat* oformat = </span><span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">av_guess_format</span><span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit">(</span><span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">"flv"</span><span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit">, </span><span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">NULL</span><span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit">, </span><span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant:inherit;font-weight:inherit;white-space:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit">NULL</span><span style="font-family:inherit;background-color:transparent;font-size:13px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit">)" </span><span style="background-color:transparent;font-family:inherit;font-size:13px;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit">and then manually edited the audio and video codec fields in "oformat" before giving it to avformat_alloc_output_context2.</span></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="background-color:transparent;font-family:inherit;font-style:inherit;font-variant-ligatures:inherit;font-variant-caps:inherit;font-weight:inherit;white-space:inherit;font-size:13px">It works and I'm able to stream audio and video.<br><br>But I get the following warning:</span></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><code style="font-size:13px;background-color:transparent;font-style:inherit;font-variant:inherit;font-weight:inherit;margin:0px;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;white-space:inherit;border-radius:0px">"Failed to update header with correct duration.</code><span style="font-size:13px">Failed to update header with correct filesize."</span></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-size:13px">In the command line, I rectified this error with the flag </span><span style="font-family:Arial,Helvetica,sans-serif">-flvflags no_duration_filesize. </span></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">Could you tell me how to set this flag in the API ?</span></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you so much.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div><div dir="ltr"><div dir="ltr"><div><div><font face="trebuchet ms, sans-serif">Best Regards,</font></div><div><font face="trebuchet ms, sans-serif">Mythili<span class="gmail_default" style="font-family:tahoma,sans-serif"> Vishalini.</span></font></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 8, 2021 at 11:19 PM Guangyu Sun via Libav-user <<a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</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>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" target="_blank">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>
_______________________________________________<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>
_______________________________________________<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>
_______________________________________________<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>