I don’t remember exactly but you can use av_copy_context api to copy all needed parameters
On Wed, Jan 1, 2020 at 17:44 Audric Ackermann <[email protected]> wrote: > And so, how can I copy all the input parameters? To get the same > parameters in the recorded file? > > Le mer. 1 janv. 2020 à 21:36, Việt Hùng Nguyễn <[email protected]> a > écrit : > >> Yes, exactly! >> >> On Wed, Jan 1, 2020, 17:10 Audric Ackermann <[email protected]> >> wrote: >> >>> But if I want to avoid missing the first few frames which are not a key >>> frame, I have to reencode the data, so the first frame recorded is a key >>> frame, right? >>> >>> Le mer. 1 janv. 2020 à 20:49, Strahinja Radman <[email protected]> >>> a écrit : >>> >>>> If you only want to copy the input, there is no need to transcode. You >>>> can simply duplicate the input packets, one packet goes to the decoder so >>>> it can be shown, the other >>>> goes to the muxer for the recorder when someone presses the record >>>> button. You can save to whatever format you want but input may not be >>>> playable from the start until >>>> it reaches the key frame. Deep packet copy can be achieved with the >>>> following code: >>>> >>>> AVPacket packet; >>>> av_init_packet(&packet); >>>> av_packet_ref(packet, src); >>>> av_packet_make_writable(&packet); >>>> >>>> You can based on the decoded frames, mark a key frame packet and start >>>> saving from there. >>>> >>>> On Wed, Jan 1, 2020 at 10:06 AM Audric Ackermann < >>>> [email protected]> wrote: >>>> >>>>> Ok thank you. >>>>> As I do not control the input parameters I will go for the transcode >>>>> option. Is there an easy way to duplicate all required decoder parameters >>>>> to the encoder? >>>>> >>>>> Like doing this, but with all important params in one step: >>>>> >>>>> Thanks >>>>> >>>>> outst->codec->width = this->codec_ctx->width; >>>>> outst->codec->height = this->codec_ctx->height; >>>>> outst->codec->pix_fmt = this->codec_ctx->pix_fmt; >>>>> outst->codec->time_base = this->codec_ctx->time_base; >>>>> _______________________________________________ >>>>> 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". >>>> >>>> >>>> >>>> -- >>>> >>>> Regards >>>> Strahinja Radman >>>> _______________________________________________ >>>> 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".
