Opened 2 years ago

Last modified 18 months ago

#9618 open defect

Trimming Error on MXF H264 All-Intra High422

Reported by: Nicolas Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: mxf
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I have some troubles when trimming without re-encoding a H264 All-Intra High 422 file (10bits) from a Canon Camera.

Here is the command I'm using :

ffmpeg.exe -loglevel trace -ss 6.74 -i Canon_Trimming_Error_H264_422_Intra_10bits.MXF -t 1 -c copy -map 0:v -map 0:a Canon_Trimming_Error_H264_422_Intra_10bits_OUT.MXF
ffmpeg Master 27/01/2022 - Commit : 3c831847a8-full
Also reproduced with ffmpeg 5.0
built on Windows

I want to cut the file from a specific frame, that's why "6.74" is given in input. Note that it can work by giving other values for input, like "6" or "6.5" for example.

I got the following error :

[mxf @ 00000251f34db180] Received non-video packet before header has been written
Error writing trailer of Canon_Trimming_Error_H264_422_Intra_10bits_OUT.MXF: Invalid data found when processing input

I tried on a lot of files I have and depending on the input I provide, sometimes it works, and other timed not with the same error.

Here is the file : https://www.dropbox.com/s/hectjvy60xf6jr4/Canon_Trimming_Error_H264_422_Intra_10bits.MXF?dl=0

Change History (5)

comment:1 by Balling, 2 years ago

Status: newopen

Okay, first of all mxf must have a video (-vn -c:a copy to mxf):

[mxf @ 00000217cf0c93c0] there must be exactly one video stream and it must be the first one

mp4 does not support pcm_s24le, and yet mkv does work:
ffmpeg.exe -ss 6.74 -i Canon_Trimming_Error_H264_422_Intra_10bits.MXF -t 1 -vn -c:a copy -map 0:a Canon_Trimming_Error_H264_422_Intra_10bits_OUT.mkv

You cannot -c:a copy this audio to mxf, yet.

ffmpeg.exe -ss 6.74 -i Canon_Trimming_Error_H264_422_Intra_10bits.MXF -t 1 -c:v copy Canon_Trimming_Error_H264_422_Intra_10bits_OUT.mxf

-c:v copy video to mp4 and then work with it -i Canon_Trimming_Error_H264_422_Intra_10bits.MXF -an -c:v copy Canon_Trimming_Error_H264_422_Intra_10bits_OUTv.mp4

TL:DR Only mkv is fully supported, BUT PLEASE use mp4 for video.

Last edited 2 years ago by Balling (previous) (diff)

comment:2 by Nicolas, 2 years ago

I didn't know Ffmpeg could not accept pcm_s24le audio for muxing MXF. It seems to work well for demuxing.

I also tried by converting to pcm_s16le and I reproduced what you said.

Is it an official behavior of ffmpeg or a bug ? Where can I find a list of available and working Audio Codecs for Muxing on MXF (or other container) ?

I didn't manage to find on the internet. Also on the libavformat/mxfenc.c I didn't see any restriction for pcm_s24le, I found that :

if (st->codecpar->codec_id != AV_CODEC_ID_PCM_S16LE &&
                    st->codecpar->codec_id != AV_CODEC_ID_PCM_S24LE) {
                    av_log(s, AV_LOG_ERROR, "Only pcm_s16le and pcm_s24le audio codecs are implemented\n");
                    return AVERROR_PATCHWELCOME;
                }


Anyway, I also tried to change the extension to mov and it seems to work indeed. But this command works also (just changing from 6.74s to 6s) so I'm not sure it is something with supported or not codec ?

ffmpeg.exe -loglevel debug -ss 6 -i Canon_Trimming_Error_H264_422_Intra_10bits.MXF -vcodec copy -map 0:v -acodec copy -map 0:a Canon_Trimming_Error_H264_422_Intra_10bits_OUT.MXF

comment:3 by Nicolas, 2 years ago

Actually no, even mkv/mov does not work. There is no real error given in ffmpeg and the file is created, but it doesn't contain any video at the end and the video can't be played with VLC / Premiere Pro.

ffmpeg.exe -loglevel debug -ss 6.74 -i Canon_Trimming_Error_H264_422_Intra_10bits.MXF -t 1 -c:v copy -map 0:v -c:a copy -map 0:a testTransformedToMov.mov

When testing with "-t 2", I get more results :

With MOV container output, I get a video output, but compression not allowed by VLC (aivx).

With MKV container output, it seems to work.

With MP4 container output, I get the following error :

[mp4 @ 0000026ab1569080] Could not find tag for codec pcm_s24le in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:4 --

So it looks like pcm_s24le is not available officially for MP4 ? Same here, where can I find the available audio codec list for MP4 container ?

comment:4 by Balling, 2 years ago

I did mention that

mp4 does not support pcm_s24le, and yet mkv does work:

As for mkv only version 4 supports it...

comment:5 by Carl Eugen Hoyos, 18 months ago

Keywords: mxf added; Trim MXF H264 Intra 422 removed
Reproduced by developer: set
Note: See TracTickets for help on using tickets.