1

FFmpeg has no trouble putting all sorts of weird video codecs into QuickTime/MOV containers, including utvideo, hap, snow, ffv1, and cinepak. This makes sense, as it is my understanding that the MOV format should be extendable to any type of video stream.

However, when I ask FFmpeg to put a vp9 video stream into a MOV container, FFmpeg refuses.

$ ffmpeg -i file-with-vp9-video-and-opus-audio.webm -vcodec copy -acodec pcm_s16be test.mov

[...]

[mov @ 0x7fbb1b822400] vp9 only supported in MP4.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Due to stupid and buggy software which is out of my control, I need a way to get VP9 streams into MOV containers. I cannot use a different container format, including mp4 or mkv. (I might be able to use WebM, but that does not support PCM audio.)

Is there another way to do this? It doesn't need to be with ffmpeg, but it does need to be with a UNIX program which I can automate in a shell script.


Edit: Quick note, I'm not opposed to doing something super weird, like muxing into an mp4 and then hex editing the header (just as an example, I don't know if the formats are close enough for that).

Which is to say, it can be a total hack. The software I'm working with will absolutely refuse to open anything that isn't a MOV, even though I have given it the capability to decode vp9.

5
  • Can you provide a link to an (pseudo-)official doc that VP9 is allowed in MOV?
    – Gyan
    Jan 14, 2021 at 5:49
  • @Gyan Not explicitly, but developer.apple.com/library/archive/documentation/QuickTime/… says the MOV format "can be used to describe almost any media structure" because "unknown objects can simply be ignored or skipped, allowing considerable forward compatibility as new object types are introduced." So I think the container should be "allowed" to have everything? I also find it hard to believe that Apple specifically defined support for niche formats like utvideo or magicyuv (both work), which were written relatively recently and by individuals. Jan 14, 2021 at 6:36
  • That's fine in theory, but in practice, metadata boxes including codec config/tags have to be written when muxing a track. Those can't be ad-hoc. We'll want either an official-ish spec or some specimen files with such streams generated by prominent apps, preferably by Apple.
    – Gyan
    Jan 14, 2021 at 11:38
  • VP9 is not supported by QTFF (see 2nd table at en.wikipedia.org/wiki/Comparison_of_video_container_formats).
    – Matt
    Jan 14, 2021 at 12:07
  • Thanks all. Even if it's not official, I still would like a way to force it in there! Otherwise I'm forced to transcode the stream. Jan 14, 2021 at 14:35

1 Answer 1

1

For my use case, it was enough to do:

ffmpeg -i file-with-vp9-video-and-opus-audio.webm -f mp4 -vcodec copy -acodec aac_at test.mov

This is cheating, really. The output isn't actually a MOV file, but rather an mp4, which uses a similar but not identical structure. Even so, it successfully coerced the program I'm using into opening the file.

Notably, outputting an mp4 and changing the file extension does not work, so the above command is producing output that's somehow different from an actual mp4. I obviously don't understand all the intricacies of how these containers work, but it was enough for today!

2
  • I can't run this cmd successfully. I get Could not find tag for codec pcm_s16be in stream #1, codec not currently supported in container
    – Gyan
    Jan 14, 2021 at 19:06
  • Oops! I posted this wrong the first time, I switched the audio codec to aac (since the container required it, and the audio isn't as important.) Jan 20, 2021 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.