[FFmpeg-user] question regarding store_user_comments

Moritz Barsnick barsnick at gmx.net
Wed Jan 25 18:44:33 EET 2017


On Wed, Jan 25, 2017 at 17:02:06 +0100, Julian Link wrote:
> [jules at deepthought ffmpeg]$ ffmpeg -i /media/120TB/hide/MXF_files/A019C046.mxf -an -f mxf_opatom -store_user_comments 1 -b:v 36M -metadata comment_x=y out.mxf

According to
$ ffmpeg -h muxer=mxf_opatom
the mxf_opatom muxer does *not* support "-store_user_comments".

The mxf muxer does though, and setting your comment works there.

If I change the MXF muxer's OpA1 code to expose and use that option
(see attached patch), it actually works:

$ ./ffmpeg_g -f lavfi -i testsrc2=s=hd1080 -f mxf_opatom -store_user_comments 1 -b:v 36M -metadata comment_x=y -t 1 ~/tmp/out.mxf -y
ffmpeg version N-83183-gd60f090 Copyright (c) 2000-2017 the FFmpeg developers
  built with icc (ICC) 14.0.3 20140422
  configuration: --prefix=/usr/new/tools/video/install/ffmpeg/2017-01-21 --cc=icc --cxx=icpc --enable-gpl --enable-version3 --enable-nonfree
 --disable-shared --enable-gnutls --enable-libcdio --enable-libfreetype --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-openal
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtwolame --enable-libopenjpeg --enable-librtmp --enable-libass --enable-li
bv4l2 --enable-libvidstab --enable-libfdk-aac --enable-libsmbclient --enable-libzvbi --enable-libtesseract --enable-libzmq
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 62.100 / 57. 62.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 69.100 /  6. 69.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, lavfi, from 'testsrc2=s=hd1080':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Output #0, mxf_opatom, to '/home/barsnick/tmp/out.mxf':
  Metadata:
    comment_x       : y
    encoder         : Lavf57.62.100
    Stream #0:0: Video: dnxhd (DNXHD), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-1024, 36000 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.75.100 dnxhd
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> dnxhd (native))
Press [q] to stop, [?] for help
[swscaler @ 0xb7bfb40] Warning: data is not aligned! This can lead to a speedloss
frame=   25 fps= 10 q=1.0 Lsize=    4607kB time=00:00:01.00 bitrate=37736.9kbits/s speed=0.402x
video:4600kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.142514%
$ ./ffmpeg_g -i ~/tmp/out.mxf
ffmpeg version N-83183-gd60f090 Copyright (c) 2000-2017 the FFmpeg developers
  built with icc (ICC) 14.0.3 20140422
  configuration: --prefix=/usr/new/tools/video/install/ffmpeg/2017-01-21 --cc=icc --cxx=icpc --enable-gpl --enable-version3 --enable-nonfree --disable-shared --enable-gnutls --enable-libcdio --enable-libfreetype --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtwolame --enable-libopenjpeg --enable-librtmp --enable-libass --enable-libv4l2 --enable-libvidstab --enable-libfdk-aac --enable-libsmbclient --enable-libzvbi --enable-libtesseract --enable-libzmq
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 62.100 / 57. 62.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 69.100 /  6. 69.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[dnxhd @ 0xbd04420] frame size changed: 1920x1088 -> 1920x1080
Input #0, mxf, from '/home/barsnick/tmp/out.mxf':
  Metadata:
    uid             : adab4424-2f25-4dc7-92ff-29bd000c0000
    generation_uid  : adab4424-2f25-4dc7-92ff-29bd000c0001
    company_name    : FFmpeg
    product_name    : OPAtom Muxer
    product_version : 57.62.100
    product_uid     : adab4424-2f25-4dc7-92ff-29bd000c0002
    modification_date: 1905-06-07T18:35:44.000000Z
    material_package_umid: 0x060A2B340101010501010D001348BF4F529471342248BF4F0052947134224800
    comment_x       : y
    timecode        : 00:00:00:00
  Duration: 00:00:01.00, start: 0.000000, bitrate: 37736 kb/s
    Stream #0:0: Video: dnxhd (DNXHD), yuv422p(bt709/unknown/unknown, progressive), 1920x1080, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010D001348BF4F529471342248BF4F0052947134224801
At least one output file must be specified
$

I may be violating the format though, what do I know. Perhaps it isn't
supported for a reason. Michael N. introduced the feature (of toggling
the storage) here:
https://github.com/FFmpeg/FFmpeg/commit/d9726893f311b7bbbc9887db2c3ffbefaad78ca3
where it is on by default for MXF, off by default for D10 (because "not
allowed"), but not at all exposed to OpA1. Do ask Michael or the MXF
maintainer...

It *is* a regression in terms of "it used to work for mxf_opatom, but
no longer does". But as said, that may be intentional... If not, submit
a proper patch and give me credit. ;-) (Or let me do it.)

Moritz
-------------- next part --------------
--- ffmpeg-build-2017-01-21/libavformat/mxfenc.c.orig	2016-10-11 18:20:03.000000000 +0200
+++ ffmpeg-build-2017-01-21/libavformat/mxfenc.c	2017-01-25 17:24:14.000000000 +0100
@@ -2706,6 +2706,8 @@
     { "mxf_audio_edit_rate", "Audio edit rate for timecode",
         offsetof(MXFContext, audio_edit_rate), AV_OPT_TYPE_RATIONAL, {.dbl=25}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
     MXF_COMMON_OPTIONS
+    { "store_user_comments", "",
+      offsetof(MXFContext, store_user_comments), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
     { NULL },
 };
 


More information about the ffmpeg-user mailing list