Message ID | 20180924005711.10144-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | e50cb8b2f440aa590f06dde0b592b312fafc85eb |
Headers | show |
On Mon, Sep 24, 2018 at 3:57 AM, James Almer <jamrial@gmail.com> wrote: > The value in AVCodecParameters->codec_tag may not be correct for IVF, > as it's the case when remuxing AV1 streams from mp4, so ignore it and > write the correct value based on codec ID instead. > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavformat/ivfenc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c > index af803d59ee..66441a2a43 100644 > --- a/libavformat/ivfenc.c > +++ b/libavformat/ivfenc.c > @@ -46,7 +46,7 @@ static int ivf_write_header(AVFormatContext *s) > avio_write(pb, "DKIF", 4); > avio_wl16(pb, 0); // version > avio_wl16(pb, 32); // header length > - avio_wl32(pb, par->codec_tag ? par->codec_tag : > + avio_wl32(pb, > par->codec_id == AV_CODEC_ID_VP9 ? AV_RL32("VP90") : > par->codec_id == AV_CODEC_ID_VP8 ? AV_RL32("VP80") : AV_RL32("AV01")); In the future we might want to make a mapping array, but for now this looks a-OK. Unfortunately the tags for AV1 do not match between IVF and ISOBMFF. LGTM. Jan
On 9/24/2018 2:54 PM, Jan Ekström wrote: > On Mon, Sep 24, 2018 at 3:57 AM, James Almer <jamrial@gmail.com> wrote: >> The value in AVCodecParameters->codec_tag may not be correct for IVF, >> as it's the case when remuxing AV1 streams from mp4, so ignore it and >> write the correct value based on codec ID instead. >> >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavformat/ivfenc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c >> index af803d59ee..66441a2a43 100644 >> --- a/libavformat/ivfenc.c >> +++ b/libavformat/ivfenc.c >> @@ -46,7 +46,7 @@ static int ivf_write_header(AVFormatContext *s) >> avio_write(pb, "DKIF", 4); >> avio_wl16(pb, 0); // version >> avio_wl16(pb, 32); // header length >> - avio_wl32(pb, par->codec_tag ? par->codec_tag : >> + avio_wl32(pb, >> par->codec_id == AV_CODEC_ID_VP9 ? AV_RL32("VP90") : >> par->codec_id == AV_CODEC_ID_VP8 ? AV_RL32("VP80") : AV_RL32("AV01")); > > In the future we might want to make a mapping array, but for now this > looks a-OK. Unfortunately the tags for AV1 do not match between IVF > and ISOBMFF. There is a mapping array, codec_ivf_tags[], but since av01 == AV01 when doing a case insensitive check, par->codec_tag ends up as the former when remuxing from mp4 to ivf, at least with ffmpeg.c > > LGTM. Pushed, thanks. > > Jan > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index af803d59ee..66441a2a43 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -46,7 +46,7 @@ static int ivf_write_header(AVFormatContext *s) avio_write(pb, "DKIF", 4); avio_wl16(pb, 0); // version avio_wl16(pb, 32); // header length - avio_wl32(pb, par->codec_tag ? par->codec_tag : + avio_wl32(pb, par->codec_id == AV_CODEC_ID_VP9 ? AV_RL32("VP90") : par->codec_id == AV_CODEC_ID_VP8 ? AV_RL32("VP80") : AV_RL32("AV01")); avio_wl16(pb, par->width);
The value in AVCodecParameters->codec_tag may not be correct for IVF, as it's the case when remuxing AV1 streams from mp4, so ignore it and write the correct value based on codec ID instead. Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/ivfenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)