How to fix AV1 Encoded output video corrupted

I tried to encode AV1 on AGX Orin 64gb Dev kit with jetpack 6.2.1 [L4T 36.4.7] installed.

test.mp4 file is AV1 encoded.

gst-launch-1.0 -e 
filesrc location=test.mp4 ! 
qtdemux name=demux demux.video_0 ! 
queue ! av1parse ! nvv4l2decoder ! 
nvvidconv ! 'video/x-raw(memory:NVMM), format=NV12' ! 
nvv4l2av1enc insert-seq-hdr=true iframeinterval=30 idrinterval=30 ! 
av1parse disable-passthrough=true ! 
qtmux ! 
filesink location=output_av1.mp4

An video file is created, but it cannot be uploaded from any site, and VLC Media Player outputs the image as AV1, but this error is infinitely output from the log.

dav1d error: Decoder feed error -22!

Firefox developer console print this:

blob:file://jetson_output_av1.mp4 Can't decode media resource. Error: Error Code: NS_ERROR_DOM_MEDIA_METADATA_ERR (0x806e0006)

Details: virtual RefPtr<MP4Demuxer::InitPromise> __cdecl mozilla::MP4Demuxer::Init(void): Parse MP4 metadata failed 

So I tried to solve the metadata problem with ffmpeg, but I couldn’t solve it because there was a problem with the video itself that was output.

[libdav1d @ 0xaaab09a1e710] libdav1d 0.9.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/cloud/hdd/test/output/test2_gst_temp.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2026-01-08T02:03:42.000000Z
  Duration: 00:08:11.23, start: 0.000000, bitrate: 1167 kb/s
  Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv, progressive), 1600x900 [SAR 1:1 DAR 16:9], 1123 kb/s, 48 fps, 48 tbr, 4800 tbn, 4800 tbc (default)
    Metadata:
      creation_time   : 2026-01-08T02:03:42.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input
Error initializing output stream 0:0 --

Hi,
Please try to mux AV1 into .mkv through matroskamux plugin. And see if the file is valid

gst-launch-1.0 -e 
filesrc location=test.mp4 ! 
qtdemux name=demux demux.video_0 ! 
queue ! av1parse ! nvv4l2decoder ! 
nvvidconv ! 'video/x-raw(memory:NVMM), format=NV12' ! 
nvv4l2av1enc insert-seq-hdr=true iframeinterval=30 idrinterval=30 bitrate=50000 ! 
av1parse disable-passthrough=true ! 
matroskamux ! 
filesink location=output_av1.mkv

Fixed dav1d issues and playback issues on firefox, but it’s still incomplete mkv, and it won’t play on google drive video preview.

mkvalidator log

ERR201: Invalid 'Colour' for profile 'matroska v2' in Video at 379
ERR201: Invalid 'Range' for profile 'matroska v2' in Colour at 399
ERR201: Invalid 'MatrixCoefficients' for profile 'matroska v2' in Colour at 399
ERR201: Invalid 'TransferCharacteristics' for profile 'matroska v2' in Colour at 399
ERR201: Invalid 'Primaries' for profile 'matroska v2' in Colour at 399
ERR200: Missing element 'Targets' in Tag at 49951054
ERR312: CueEntry Track #1 and timecode 20 ms not found
ERR312: CueEntry Track #1 and timecode 41 ms not found
ERR312: CueEntry Track #1 and timecode 62 ms not found
ERR312: CueEntry Track #1 and timecode 145 ms not found
ERR312: CueEntry Track #1 and timecode 166 ms not found
ERR312: CueEntry Track #1 and timecode 187 ms not found
ERR312: CueEntry Track #1 and timecode 270 ms not found
ERR312: CueEntry Track #1 and timecode 291 ms not found
(skip)
ERR312: CueEntry Track #1 and timecode 991520 ms not found
ERR312: CueEntry Track #1 and timecode 991541 ms not found
ERR312: CueEntry Track #1 and timecode 991562 ms not found
ERR312: CueEntry Track #1 and timecode 991645 ms not found
ERR312: CueEntry Track #1 and timecode 991666 ms not found
ERR312: CueEntry Track #1 and timecode 991687 ms not found
.       file "output_av1.mkv"
        created with GStreamer matroskamux version 1.20.3 / GStreamer Matroska muxer

Hi,
Please apply this lib and see if it helps:

Making sure you're not a bot!
[MMAPI] forceIDR does not work well in AV1 encoding

And please try iframeinterval=0. see if it helps by enabling only IDR frames.

No luck. still most websites said it’s not video file and same mkvalidator log.

Hi,

I created some videos and tested them using the same pipelines described in this forum, but I wasn’t able to reproduce the issue with the Google Drive preview.

Could you please share the test.mp4 file or the pipeline used to generate that video so I can take a closer look?

gst-launch-1.0 -e 
filesrc location=test.mp4 ! 
qtdemux name=demux demux.video_0 ! 
queue ! av1parse ! nvv4l2decoder ! 
nvvidconv ! 'video/x-raw(memory:NVMM), format=NV12' ! 
nvv4l2av1enc insert-seq-hdr=true iframeinterval=0 ! 
av1parse ! 
qtmux ! 
filesink location=output_av1.mp4

AV1 MP4 → AV1 MP4

Hi,

Thanks for sharing the video. I tested the pipelines and was able to reproduce the same error you mentioned. However, when I tried the following pipeline, the resulting file plays correctly in the Google Drive video preview.

You can find the pipeline below:

gst-launch-1.0 filesrc location=2025-09-13_21-58-01.mp4 ! qtdemux name=demux demux.video_0 ! queue ! av1parse ! nvv4l2decoder ! nvv4l2av1enc insert-seq-hdr=true iframeinterval=30 idrinterval=30 bitrate=50000 ! av1parse disable-passthrough=true ! matroskamux ! filesink location=output_av1.mkv -ev

Just to make sure we are on the same page, I tested this pipeline on an AGX Orin running JetPack 6.

Also, could you let me know which other websites or players you are using to test the video? I can check compatibility on my side as well.

Still can’t use mkv in a lot of places, so I should use mp4 if possible.

example - google gemini, windows 11 default file manager (no metadata)

I tested it on VLC player (mkv work but spam video corrupted log) and Firefox browser.

Hi,

Following your need of using mp4, I tested the pipeline using nvv4l2h264enc instead. The generated MP4 video works correctly in both the Google Drive preview and the Firefox browser.

gst-launch-1.0 filesrc location=2025-09-13_21-58-01.mp4 ! qtdemux name=demux demux.video_0 ! queue ! av1parse ! nvv4l2decoder ! nvv4l2h264enc bitrate=5000000 iframeinterval=30 idrinterval=30 insert-sps-pps=true ! h264parse config-interval=-1 ! mp4mux faststart=true ! filesink location=output_h264.mp4 -ev

However, when using nvav1enc, I observed the same issue where the output is not recognized as a valid video file. For example, Google Drive’s supported formatsindicate that MP4, 3GPP, and MOV containers expect H.264 or MPEG-4 video codecs with AAC audio. This behavior is also consistent with Firefox.

If you need to use the MP4 container, I recommend using it with H.264 encoding. If AV1 is required, you can generate a compatible file using a container such as Matroska (matroskamux).

1 Like

I haven’t tested more, but for now, both MP4 and MKV generate incomplete video files, so it’s thought to be a bug. (Youtube is doing MP4 AV1 encoding, so I don’t think it’s an MP4 problem.)

In this state, OpenCV processing of ffmpeg and python is difficult, and even simple video storage is not safe.

I’ll have to wait until the bug is fixed.