diff mbox series

[FFmpeg-devel] lavf/movenc: Do not write empty av1C boxes

Message ID CAB0OVGrsBT46WQxDVsynun5wXt1FuucJmz6jiGfFxa3bwJbdzg@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] lavf/movenc: Do not write empty av1C boxes | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Carl Eugen Hoyos March 30, 2020, 10:19 p.m. UTC
Hi!

Attached patch avoids writing an mp4 file that cannot be read by
FFmpeg (only be vlc) in some use cases.

Please comment, Carl Eugen

Comments

James Almer March 30, 2020, 10:35 p.m. UTC | #1
On 3/30/2020 7:19 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch avoids writing an mp4 file that cannot be read by
> FFmpeg (only be vlc) in some use cases.
> 
> Please comment, Carl Eugen

This enables writing non compliant files, so no.
We should instead check the return value of mov_write_av1c_tag() (and
that function in turn check the return value of ff_isom_write_av1c()),
and propagate it.
Carl Eugen Hoyos March 30, 2020, 10:44 p.m. UTC | #2
Am Di., 31. März 2020 um 00:35 Uhr schrieb James Almer <jamrial@gmail.com>:
>
> On 3/30/2020 7:19 PM, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch avoids writing an mp4 file that cannot be read by
> > FFmpeg (only be vlc) in some use cases.
> >
> > Please comment, Carl Eugen
>
> This enables writing non compliant files, so no.

The current situation is that unreadable files are
written, so I don't think this is a very useful answer.

Carl Eugen
James Almer March 30, 2020, 10:54 p.m. UTC | #3
On 3/30/2020 7:44 PM, Carl Eugen Hoyos wrote:
> Am Di., 31. März 2020 um 00:35 Uhr schrieb James Almer <jamrial@gmail.com>:
>>
>> On 3/30/2020 7:19 PM, Carl Eugen Hoyos wrote:
>>> Hi!
>>>
>>> Attached patch avoids writing an mp4 file that cannot be read by
>>> FFmpeg (only be vlc) in some use cases.
>>>
>>> Please comment, Carl Eugen
>>
>> This enables writing non compliant files, so no.
> 
> The current situation is that unreadable files are
> written, so I don't think this is a very useful answer.
> 
> Carl Eugen

Both the current situation and the one you propose are unacceptable.
Hence me asking you to propagate errors instead of ignoring them in this
kind of scenario, seeing it's not a valid one.
diff mbox series

Patch

From 42b5e30f3bf13620a41ed92181f7b0358873e764 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Tue, 31 Mar 2020 00:17:44 +0200
Subject: [PATCH] lavf/movenc: Do not write an empty av1C box.

---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 1c178fc4bc..8cdd406335 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2098,7 +2098,7 @@  static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
             mov_write_uuid_tag_ipod(pb);
     } else if (track->par->codec_id == AV_CODEC_ID_VP9) {
         mov_write_vpcc_tag(mov->fc, pb, track);
-    } else if (track->par->codec_id == AV_CODEC_ID_AV1) {
+    } else if (track->par->codec_id == AV_CODEC_ID_AV1 && track->vos_len > 0) {
         mov_write_av1c_tag(pb, track);
     } else if (track->par->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0)
         mov_write_dvc1_tag(pb, track);
-- 
2.24.1