Hello, Thank you so much again for the quick response. I'll check them. Thank you.
Best Regards, Mythili On Wed, Jun 9, 2021 at 11:06 PM Guangyu Sun via Libav-user < [email protected]> wrote: > Hi Mythili, > > Check these two functions. Setting flvflags to the options should work. > > int avformat_write_header(AVFormatContext *s, AVDictionary **options); > int avformat_init_output(AVFormatContext *s, AVDictionary **options); > > Thanks, > Guangyu > > On Tue, Jun 8, 2021 at 9:46 PM Mythili Vishalini Anbazhagan < > [email protected]> wrote: > >> Hello, >> Thank you so much for the information. I will try that and see. >> >> I have found a workaround. Don't know if this is the correct way of doing >> this though. >> Created AVOutputFormat using "AVOutputFormat* oformat = av_guess_format( >> "flv", NULL, NULL)" and then manually edited the audio and video codec >> fields in "oformat" before giving it to avformat_alloc_output_context2. >> It works and I'm able to stream audio and video. >> >> But I get the following warning: >> "Failed to update header with correct duration.Failed to update header >> with correct filesize." >> In the command line, I rectified this error with the flag -flvflags >> no_duration_filesize. >> Could you tell me how to set this flag in the API ? >> >> Thank you so much. >> >> Best Regards, >> Mythili Vishalini. >> >> >> On Tue, Jun 8, 2021 at 11:19 PM Guangyu Sun via Libav-user < >> [email protected]> wrote: >> >>> This might be what you are looking for: >>> AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); >>> >>> Specify the correct codec when adding streams to the AVFormatContext >>> created by avformat_alloc_output_context2(). >>> >>> On Mon, Jun 7, 2021 at 11:39 PM Mythili Vishalini Anbazhagan < >>> [email protected]> wrote: >>> >>>> Hi, >>>> 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. >>>> >>>> In Detail: >>>> The following command works perfectly for me. >>>> 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://192.168.1.7/live/surface >>>> In the output, I have set my audio codec to be aac and copied the video >>>> codec from input, which is H264. >>>> I want to emulate this in the library, but don't know how to. >>>> 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 ? >>>> >>>> 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. >>>> 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. >>>> >>>> Any hint/guidance is hugely appreciated. Thank you. >>>> >>>> _______________________________________________ >>>> Libav-user mailing list >>>> [email protected] >>>> https://ffmpeg.org/mailman/listinfo/libav-user >>>> >>>> To unsubscribe, visit link above, or email >>>> [email protected] with subject "unsubscribe". >>>> >>> _______________________________________________ >>> Libav-user mailing list >>> [email protected] >>> https://ffmpeg.org/mailman/listinfo/libav-user >>> >>> To unsubscribe, visit link above, or email >>> [email protected] with subject "unsubscribe". >>> >> _______________________________________________ >> Libav-user mailing list >> [email protected] >> https://ffmpeg.org/mailman/listinfo/libav-user >> >> To unsubscribe, visit link above, or email >> [email protected] with subject "unsubscribe". >> > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". >
_______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
