[FFmpeg-user] MXF Op1a with JPEG2000 - Field Order Problem (Frame Layout and Field Dominance)
Christoph Gerstbauer
christoph.gerstbauer at gmail.com
Tue Dec 20 14:30:07 EET 2022
Hello FFmpeg Developers!
I am currently trying to produce a interoperable MXF OP1a with JPEG2000+PCM.
The content is interlaced material in PAL (tff), including VBI (720x608)
My used syntax:
ffmpeg -i J:\JPEG2000\8bit_10min_01_ffvhuff.avi -c:v libopenjpeg -acodec
pcm_s24le -f mxf -timecode 10:00:00:00 -metadata
"creation_time=2022-12-18T15:37:56" -r 25 -signal_standard 1 -colorspace
bt470bg -color_range tv -color_primaries bt470bg -color_trc gamma28 -aspect
4:3 -vf "setfield=tff,fieldorder=tff" -top 1 -format:v j2k -profile:v
jpeg2000 -cinema_mode:v off -irreversible:v 0 -prog_order 0
J:\JPEG2000\8bit_10min_01_ffvhuff.mxf
As you can see, I am setting the field oredr twice via "-top 1" and
"-fieldorder=tff". So I assume that I will get a MXF with interlaced flags:
Typical:
signal_standard : ITU_601 (value='1')
frame_layout : Separate Field (value='1')
Field Dominance : 1
But I get
signal_standard : ITU_601 (value='1')
frame_layout : Full_Frame (value='0')
Field Dominance : not set
Checked via mxf2raw and mxfdump from the BMX MXF toolset.
I also tried to reset the frame_layout via bmxtranswrap but it sticked to
FULLFRAME. I dont know why.
My questions:
1.) Is it possible to give the ffmpeg MUXER more settings beside -f mxf and
-signal_standard 1 so that I have more control to set specific flags/KLVs?
2.) Due frame_layout is not set to seperate fields by using "-top 1" or
"fieldorder=tff".... Is there room for improvement?
br Christoph
output of mxf2raw:
edit_rate : 25/1
duration : 00:10:00:00 (count='15000')
StartTimecodes:
material : 10:00:00:00
file_source : 10:00:00:00
Tracks: (2)
Track #0:
essence_kind : Picture
essence_type : JPEG2000_CDCI
ec_label : urn:smpte:ul:060e2b34.04010107.0d010301.020c0100
edit_rate : 25/1
duration : 00:10:00:00 (count='15000')
Packages: (1)
Package #0:
Material:
package_uid :
urn:smpte:umid:060a2b34.01010105.01010d00.13c54e3f.52947134.9ec54e3f.00529471.349ec500
track_id : 2
track_number : 0
FileSource:
package_uid :
urn:smpte:umid:060a2b34.01010105.01010d00.13c54e3f.52947134.9ec54e3f.00529471.349ec501
track_id : 2
track_number : 0x15010800
file_uri : file:///J:/JPEG2000/8bit_10min_01_ffvhuff.mxf
PictureDescriptor:
coding_label : urn:smpte:ul:060e2b34.04010107.04010202.03010100
signal_standard : ITU_601 (value='1')
frame_layout : Full_Frame (value='0')
stored_width : 720
stored_height : 608
display_width : 720
display_height : 576
display_x_offset : 0
display_y_offset : 32
aspect_ratio : 4/3
CDCIDescriptor:
component_depth : 8
horiz_subsamp : 2
vert_subsamp : 1
color_siting : Cositing (value='0')
Track #1:
essence_kind : Sound
essence_type : WAVE_PCM
ec_label : urn:smpte:ul:060e2b34.04010101.0d010301.02060300
edit_rate : 25/1
duration : 00:10:00:00 (count='15000')
Packages: (1)
Package #0:
Material:
package_uid :
urn:smpte:umid:060a2b34.01010105.01010d00.13c54e3f.52947134.9ec54e3f.00529471.349ec500
track_id : 3
track_number : 0
FileSource:
package_uid :
urn:smpte:umid:060a2b34.01010105.01010d00.13c54e3f.52947134.9ec54e3f.00529471.349ec501
track_id : 3
track_number : 0x16010300
file_uri : file:///J:/JPEG2000/8bit_10min_01_ffvhuff.mxf
SoundDescriptor:
sampling_rate : 48000/1
bits_per_sample : 24
block_align : 24
channel_count : 8
locked : true
Output of mxfdump :
[ K = MXFCDCIEssenceDescriptor ( 00000000000013cf )
06.0e.2b.34.02.53.01.01.0d.01.01.01.01.01.28.00, L = 321 (141), LL =
4 ]
[ k = InstanceUID
3c.0a, l = 16 (0010) ]
0 ad ab 44 24 2f 25 4d c7 92 ff 29 bd 00 0e 00 00
..D$/%M...).....
[ k = LinkedTrackID
30.06, l = 4 (0004) ]
0 00 00 00 02 ....
[ k = SampleRate
30.01, l = 8 (0008) ]
0 00 00 00 19 00 00 00 01 ........
[ k = EssenceContainer
30.04, l = 16 (0010) ]
0 06 0e 2b 34 04 01 01 07 0d 01 03 01 02 0c 01 00
..+4............
[ k = StoredWidth
32.03, l = 4 (0004) ]
0 00 00 02 d0 ....
[ k = StoredHeight
32.02, l = 4 (0004) ]
0 00 00 02 60 ...`
[ k = SampledWidth
32.05, l = 4 (0004) ]
0 00 00 02 d0 ....
[ k = SampledHeight
32.04, l = 4 (0004) ]
0 00 00 02 60 ...`
[ k = SampledXOffset
32.06, l = 4 (0004) ]
0 00 00 00 00 ....
[ k = SampledYOffset
32.07, l = 4 (0004) ]
0 00 00 00 00 ....
[ k = DisplayWidth
32.09, l = 4 (0004) ]
0 00 00 02 d0 ....
[ k = DisplayHeight
32.08, l = 4 (0004) ]
0 00 00 02 40 ...@
[ k = DisplayXOffset
32.0a, l = 4 (0004) ]
0 00 00 00 00 ....
[ k = DisplayYOffset
32.0b, l = 4 (0004) ]
0 00 00 00 20 ...
[ k = ComponentDepth
33.01, l = 4 (0004) ]
0 00 00 00 08 ....
[ k = HorizontalSubsampling
33.02, l = 4 (0004) ]
0 00 00 00 02 ....
[ k = VerticalSubsampling
33.08, l = 4 (0004) ]
0 00 00 00 01 ....
[ k = ColorSiting
33.03, l = 1 (0001) ]
0 00 .
[ k = PaddingBits
33.07, l = 2 (0002) ]
0 00 00 ..
[ k = BlackRefLevel
33.04, l = 4 (0004) ]
0 00 00 00 10 ....
[ k = WhiteReflevel
33.05, l = 4 (0004) ]
0 00 00 00 eb ....
[ k = ColorRange
33.06, l = 4 (0004) ]
0 00 00 00 e1 ....
[ k = SignalStandard
32.15, l = 1 (0001) ]
0 01 .
[ k = FrameLayout
32.0c, l = 1 (0001) ]
0 00 .
[ k = VideoLineMap
32.0d, l = 16 (0010) ]
0 00 00 00 02 00 00 00 04 00 00 00 0e 00 00 00 00
................
[ k = AspectRatio
32.0e, l = 8 (0008) ]
0 00 00 00 04 00 00 00 03 ........
[ k = Dark
32.19, l = 16 (0010) ]
0 06 0e 2b 34 04 01 01 06 04 01 01 01 03 02 00 00
..+4............
[ k = Gamma
32.10, l = 16 (0010) ]
0 06 0e 2b 34 04 01 01 01 04 01 01 01 01 01 00 00
..+4............
[ k = Dark
32.1a, l = 16 (0010) ]
0 06 0e 2b 34 04 01 01 01 04 01 01 01 02 01 00 00
..+4............
[ k = PictureEssenceCoding
32.01, l = 16 (0010) ]
0 06 0e 2b 34 04 01 01 07 04 01 02 02 03 01 01 00
..+4............
Command Line output:
ffmpeg -i J:\JPEG2000\8bit_10min_01_ffvhuff.avi -c:v libopenjpeg -acodec
pcm_s24le -f mxf -timecode 10:00:00:00 -metadata
"creation_time=2022-10-28T15:37:56" -r 25 -signal_standard 1 -colorspace
bt470bg -color_range tv -color_primaries bt470bg -color_trc gamma28 -aspect
4:3 -vf "setfield=tff,fieldorder=tff" -top 1 -format:v j2k -profile:v
jpeg2000 -cinema_mode:v off -irreversible:v 0 -prog_order 0
J:\JPEG2000\8bit_10min_01_ffvhuff.mxf -loglevel debug
ffmpeg version n5.1.2-9-g807afa59cc-20221219 Copyright (c) 2000-2022 the
FFmpeg developers
built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static
--pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64
--target-os=mingw32 --enable-version3 --disable-debug --disable-w32threads
--enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib
--enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma
--enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse
--enable-libvmaf --disable-libxcb --disable-xlib --enable-amf
--enable-libaom --enable-libaribb24 --disable-avisynth
--disable-chromaprint --enable-libdav1d --disable-libdavs2
--disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --disable-frei0r
--enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray
--enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist
--enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp
--enable-lv2 --enable-libmfx --disable-openal --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg
--enable-libopenmpt --enable-librav1e --disable-librubberband
--enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt
--enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm
--disable-vaapi --disable-libvidstab --enable-vulkan --enable-libshaderc
--enable-libplacebo --disable-libx264 --disable-libx265 --disable-libxavs2
--disable-libxvid --enable-libzimg --enable-libzvbi
--extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags=
--extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp
--extra-version=20221219
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument
'J:\JPEG2000\8bit_10min_01_ffvhuff.avi'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument
'libopenjpeg'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'pcm_s24le'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'mxf'.
Reading option '-timecode' ... matched as option 'timecode' (set initial
TimeCode value.) with argument '10:00:00:00'.
Reading option '-metadata' ... matched as option 'metadata' (add metadata)
with argument 'creation_time=2022-10-28T15:37:56'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '25'.
Reading option '-signal_standard' ... matched as AVOption 'signal_standard'
with argument '1'.
Reading option '-colorspace' ... matched as AVOption 'colorspace' with
argument 'bt470bg'.
Reading option '-color_range' ... matched as AVOption 'color_range' with
argument 'tv'.
Reading option '-color_primaries' ... matched as AVOption 'color_primaries'
with argument 'bt470bg'.
Reading option '-color_trc' ... matched as AVOption 'color_trc' with
argument 'gamma28'.
Reading option '-aspect' ... matched as option 'aspect' (set aspect ratio
(4:3, 16:9 or 1.3333, 1.7777)) with argument '4:3'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with
argument 'setfield=tff,fieldorder=tff'.
Reading option '-top' ... matched as option 'top' (top=1/bottom=0/auto=-1
field first) with argument '1'.
Reading option '-format:v' ... matched as AVOption 'format:v' with argument
'j2k'.
Reading option '-profile:v' ... matched as option 'profile' (set profile)
with argument 'jpeg2000'.
Reading option '-cinema_mode:v' ... matched as AVOption 'cinema_mode:v'
with argument 'off'.
Reading option '-irreversible:v' ... matched as AVOption 'irreversible:v'
with argument '0'.
Reading option '-prog_order' ... matched as AVOption 'prog_order' with
argument '0'.
Reading option 'J:\JPEG2000\8bit_10min_01_ffvhuff.mxf' ... matched as
output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url J:\JPEG2000\8bit_10min_01_ffvhuff.avi.
Successfully parsed a group of options.
Opening an input file: J:\JPEG2000\8bit_10min_01_ffvhuff.avi.
[NULL @ 00000191be703cc0] Opening 'J:\JPEG2000\8bit_10min_01_ffvhuff.avi'
for reading
[file @ 00000191bcc09d80] Setting default whitelist 'file,crypto,data'
[avi @ 00000191be703cc0] Format avi probed with size=2048 and score=100
[avi @ 00000191be70c140] use odml:1
[avi @ 00000191be703cc0] Before avformat_find_stream_info() pos: 10112
bytes read:1042352 seeks:30 nb_streams:2
[avi @ 00000191be703cc0] parser not found for codec ffvhuff, packets or
times may be invalid.
[avi @ 00000191be703cc0] parser not found for codec pcm_s24le, packets or
times may be invalid.
[avi @ 00000191be703cc0] parser not found for codec ffvhuff, packets or
times may be invalid.
[avi @ 00000191be703cc0] parser not found for codec pcm_s24le, packets or
times may be invalid.
[avi @ 00000191be703cc0] All info found
[avi @ 00000191be703cc0] After avformat_find_stream_info() pos: 281732
bytes read:1322156 seeks:30 frames:2
Input #0, avi, from 'J:\JPEG2000\8bit_10min_01_ffvhuff.avi':
Metadata:
software : Lavf59.16.100
Duration: 00:10:00.00, start: 0.000000, bitrate: 90829 kb/s
Stream #0:0, 1, 1/25: Video: ffvhuff, 1 reference frame (FFVH /
0x48564646), yuv422p, 720x608, 0/1, 81607 kb/s, SAR 93:85 DAR 837:646, 25
fps, 25 tbr, 25 tbn
Stream #0:1, 1, 1/48000: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000
Hz, 7.1, s32 (24 bit), 9216 kb/s
Successfully opened the file.
Parsing a group of options: output url
J:\JPEG2000\8bit_10min_01_ffvhuff.mxf.
Applying option c:v (codec name) with argument libopenjpeg.
Applying option acodec (force audio codec ('copy' to copy stream)) with
argument pcm_s24le.
Applying option f (force format) with argument mxf.
Applying option timecode (set initial TimeCode value.) with argument
10:00:00:00.
Applying option metadata (add metadata) with argument
creation_time=2022-10-28T15:37:56.
Applying option r (set frame rate (Hz value, fraction or abbreviation))
with argument 25.
Applying option aspect (set aspect ratio (4:3, 16:9 or 1.3333, 1.7777))
with argument 4:3.
Applying option vf (set video filters) with argument
setfield=tff,fieldorder=tff.
Applying option top (top=1/bottom=0/auto=-1 field first) with argument 1.
Applying option profile:v (set profile) with argument jpeg2000.
Successfully parsed a group of options.
Opening an output file: J:\JPEG2000\8bit_10min_01_ffvhuff.mxf.
File 'J:\JPEG2000\8bit_10min_01_ffvhuff.mxf' already exists. Overwrite?
[y/N] y
[file @ 00000191bcc0ec40] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
detected 12 logical cores
Stream mapping:
Stream #0:0 -> #0:0 (ffvhuff (native) -> jpeg2000 (libopenjpeg))
Stream #0:1 -> #0:1 (pcm_s24le (native) -> pcm_s24le (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if
it occurs once at the start per stream)
Last message repeated 1 times
[graph_1_in_0_1 @ 00000191be790140] Setting 'time_base' to value '1/48000'
[graph_1_in_0_1 @ 00000191be790140] Setting 'sample_rate' to value '48000'
[graph_1_in_0_1 @ 00000191be790140] Setting 'sample_fmt' to value 's32'
[graph_1_in_0_1 @ 00000191be790140] Setting 'channel_layout' to value '7.1'
[graph_1_in_0_1 @ 00000191be790140] tb:1/48000 samplefmt:s32
samplerate:48000 chlayout:7.1
[format_out_0_1 @ 00000191bedeef00] Setting 'sample_fmts' to value 's32'
[AVFilterGraph @ 00000191be70a780] query_formats: 4 queried, 9 merged, 0
already done, 0 delayed
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if
it occurs once at the start per stream)
Last message repeated 33 times
[Parsed_setfield_0 @ 00000191bf5eee80] Setting 'mode' to value 'tff'
[Parsed_fieldorder_1 @ 00000191c08d4940] Setting 'order' to value 'tff'
[graph 0 input from stream 0:0 @ 00000191c08d4c40] Setting 'video_size' to
value '720x608'
[graph 0 input from stream 0:0 @ 00000191c08d4c40] Setting 'pix_fmt' to
value '4'
[graph 0 input from stream 0:0 @ 00000191c08d4c40] Setting 'time_base' to
value '1/25'
[graph 0 input from stream 0:0 @ 00000191c08d4c40] Setting 'pixel_aspect'
to value '93/85'
[graph 0 input from stream 0:0 @ 00000191c08d4c40] Setting 'frame_rate' to
value '25/1'
[graph 0 input from stream 0:0 @ 00000191c08d4c40] w:720 h:608
pixfmt:yuv422p tb:1/25 fr:25/1 sar:93/85
[format @ 00000191c08d4640] Setting 'pix_fmts' to value
'rgb24|rgba|rgb48le|rgba64le|gbrp|gbrp9le|gbrp10le|gbrp12le|gbrp14le|gbrp16le|gray|ya8|gray16le|ya16le|gray10le|gray12le|gray14le|yuv420p|yuv422p|yuva420p|yuv440p|yuv444p|yuva422p|yuv411p|yuv410p|yuva444p|yuv420p9le|yuv422p9le|yuv444p9le|yuva420p9le|yuva422p9le|yuva444p9le|yuv420p10le|yuv422p10le|yuv444p10le|yuva420p10le|yuva422p10le|yuva444p10le|yuv420p12le|yuv422p12le|yuv444p12le|yuv420p14le|yuv422p14le|yuv444p14le|yuv420p16le|yuv422p16le|yuv444p16le|yuva420p16le|yuva422p16le|yuva444p16le|xyz12le'
[AVFilterGraph @ 00000191c0005140] query_formats: 5 queried, 4 merged, 0
already done, 0 delayed
[Parsed_fieldorder_1 @ 00000191c08d4940] Skipping frame with same field
order.
[pcm_rechunk_bsf @ 00000191c0509900] Setting entry with key 'r' to value
'25/1'
Automatically inserted bitstream filter 'pcm_rechunk'; args='r=25/1'
Output #0, mxf, to 'J:\JPEG2000\8bit_10min_01_ffvhuff.mxf':
Metadata:
software : Lavf59.16.100
timecode : 10:00:00:00
creation_time : 2022-10-28T15:37:56
encoder : Lavf59.27.100
Stream #0:0, 0, 1/25: Video: jpeg2000, 1 reference frame, yuv422p(tv,
bt470bg, top first), 720x608 (0x0) [SAR 152:135 DAR 4:3], 0/1, q=2-31, 200
kb/s, 25 fps, 25 tbn
Metadata:
encoder : Lavc59.37.100 libopenjpeg
Stream #0:1, 0, 1/48000: Audio: pcm_s24le, 48000 Hz, 7.1, s32 (24 bit),
9216 kb/s
Metadata:
encoder : Lavc59.37.100 pcm_s24le
More information about the ffmpeg-user
mailing list