From: Pierre-Anthony Lemieux <pal@sandflow.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH v1] avformat/imfdec: preserve stream information Date: Sun, 3 Jul 2022 13:39:52 -0700 Message-ID: <CAF_7JxCOS0OtnmUqG0ZeoV-UZLeatX4x5JKRQRcdNG1voi8MNg@mail.gmail.com> (raw) In-Reply-To: <DB6PR0101MB221492F307DB7FEA46281EE98FBF9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> On Sun, Jul 3, 2022 at 12:15 PM Andreas Rheinhardt <andreas.rheinhardt@outlook.com> wrote: > > Pierre-Anthony Lemieux: > > On Sun, Jul 3, 2022 at 11:28 AM Andreas Rheinhardt > > <andreas.rheinhardt@outlook.com> wrote: > >> > >> pal@sandflow.com: > >>> From: Pierre-Anthony Lemieux <pal@palemieux.com> > >>> > >>> As discussed at https://trac.ffmpeg.org/ticket/9818, the IMF demuxer does not > >>> currently preserve stream information such as language in the case of audio > >>> streams. This patch is modeled on copy_stream_props() at avformat/concatdec.c. > >>> > >>> --- > >>> libavformat/imfdec.c | 5 +++++ > >>> 1 file changed, 5 insertions(+) > >>> > >>> diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c > >>> index 71dfb26958..7aa66a06bf 100644 > >>> --- a/libavformat/imfdec.c > >>> +++ b/libavformat/imfdec.c > >>> @@ -580,11 +580,16 @@ static int set_context_streams_from_tracks(AVFormatContext *s) > >>> return AVERROR(ENOMEM); > >>> } > >>> asset_stream->id = i; > >>> + asset_stream->r_frame_rate = first_resource_stream->r_frame_rate; > >>> + asset_stream->avg_frame_rate = first_resource_stream->avg_frame_rate; > >>> + asset_stream->sample_aspect_ratio = first_resource_stream->sample_aspect_ratio; > >>> ret = avcodec_parameters_copy(asset_stream->codecpar, first_resource_stream->codecpar); > >>> if (ret < 0) { > >>> av_log(s, AV_LOG_ERROR, "Could not copy stream parameters\n"); > >>> return ret; > >>> } > >>> + av_dict_copy(&asset_stream->metadata, first_resource_stream->metadata, 0); > >>> + ff_stream_side_data_copy(asset_stream, first_resource_stream); > >>> avpriv_set_pts_info(asset_stream, > >>> first_resource_stream->pts_wrap_bits, > >>> first_resource_stream->time_base.num, > >> > >> Seems to me like one should use ff_stream_encode_params_copy here. Of > >> course, it would have to be renamed and moved if used in a demuxer. > > > > Would copy_stream_props() in concatdec.c need to be refactored as well? > > > > I often wondered about this. The problem with copy_stream_props is that > it is not only called during read_header, but lateron as well, but e.g. > the documentation of AVStream.side_data says that it is populated when > the stream is created and not later. > This issue does of course not exist in your case. ff_stream_encode_params_copy() does not seem to set pts_wrap_bits, i.e. it does not call avpriv_set_pts_info(). > > > Note that, in the case of avformat/imfdec.c, AVStream::id is not > > copied across, so ff_stream_encode_params_copy() would need to be > > followed by asset_stream->id = i; > > > > Yeah, I know. > > - Andreas > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-07-03 20:40 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-03 18:15 pal 2022-07-03 18:27 ` Andreas Rheinhardt 2022-07-03 18:39 ` Pierre-Anthony Lemieux 2022-07-03 19:15 ` Andreas Rheinhardt 2022-07-03 20:39 ` Pierre-Anthony Lemieux [this message] 2022-07-03 21:12 ` Andreas Rheinhardt 2022-07-10 18:20 ` Pierre-Anthony Lemieux
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CAF_7JxCOS0OtnmUqG0ZeoV-UZLeatX4x5JKRQRcdNG1voi8MNg@mail.gmail.com \ --to=pal@sandflow.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git