Opened 5 years ago

Last modified 3 years ago

#7905 new defect

Support Extended Language Tag Atom (elng) for MOV muxer

Reported by: jeanhackman Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mov
Cc: Marton Balint Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Attempting to use ffmpeg to set audio language to "frm" results in audio language of English on output file. Tried alternate language codes - "spa" and "por" and they work as expected where audio language on output file is Spanish or Portuguese respectively.

How to reproduce:

% ffmpeg -i test_pattern.mov \
-i french_5.1_audio/5.1_pcm_fra.aiff \
-i stereo_pcm_fra_dvs_audio.aiff \
-vcodec copy \
-map 0:0:v \
-acodec copy \
-map 1:0:a -metadata:s:a:0 language=fra \
-map 2:0:a -metadata:s:a:1 language=frm \
audio_map_test_files/test_pattern_fra51_fraDVS.mov

ffmpeg version N-93873-g6276b4db97
built on May 16 2019 built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)

Attachments (3)

all_input_file_debug.txt (89.7 KB ) - added by jeanhackman 5 years ago.
ffmpeg -v 9 -loglevel 99 -i output per each input of 3 input files used
5.1_pcm_fra.aiff (1.1 MB ) - added by jeanhackman 5 years ago.
stereo_pcm_fra_dvs_audio.aiff (178.8 KB ) - added by jeanhackman 5 years ago.

Download all attachments as: .zip

Change History (19)

by jeanhackman, 5 years ago

Attachment: all_input_file_debug.txt added

ffmpeg -v 9 -loglevel 99 -i output per each input of 3 input files used

comment:1 by jeanhackman, 5 years ago

I used the following command to create "test_pattern.mov" input file

ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=60 -vcodec test_pattern.mov

by jeanhackman, 5 years ago

Attachment: 5.1_pcm_fra.aiff added

by jeanhackman, 5 years ago

comment:2 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegavformat
Keywords: mov added; audio language descriptor removed
Version: unspecifiedgit-master

Does it work if you use the file suffix .mp4?
Do you have a mov file with the intended language descriptor?

comment:3 by jeanhackman, 5 years ago

Hi cehoyos,

Thank you for looking into this.
It appears ProRes is not a supported format in mp4 container:

ffmpeg -i test_pattern.mov \
-i french_5.1_audio/5.1_pcm_fra.aiff \
-i stereo_pcm_fra_dvs_audio.aiff \
-vcodec copy \
-map 0:v \
-acodec copy \
-map 1:a -metadata:s:a:0 language=fra \
-map 2:a -metadata:s:a:1 language=frm \
audio_map_test_files/test_pattern_fra51_fraDVS.mp4
ffmpeg version N-93873-g6276b4db97 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
  configuration:
  libavutil      56. 28.100 / 56. 28.100
  libavcodec     58. 52.101 / 58. 52.101
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 53.101 /  7. 53.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_pattern.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.12.100
  Duration: 00:00:10.00, start: 0.000000, bitrate: 37525 kb/s
    Stream #0:0(eng): Video: prores (Standard) (apcn / 0x6E637061), yuv422p10le(tv, smpte170m/unknown/unknown, progressive), 1280x720, 37522 kb/s, SAR 1:1 DAR 16:9, 60 fps, 60 tbr, 15360 tbn, 15360 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.18.100 prores
Input #1, aiff, from 'french_5.1_audio/5.1_pcm_fra.aiff':
  Duration: 00:00:04.50, start: 0.000000, bitrate: 2116 kb/s
    Stream #1:0: Audio: pcm_s16be, 22050 Hz, 5.1(side), s16, 2116 kb/s
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, aiff, from 'stereo_pcm_fra_dvs_audio.aiff':
  Duration: 00:00:02.08, start: 0.000000, bitrate: 705 kb/s
    Stream #2:0: Audio: pcm_s16be, 22050 Hz, stereo, s16, 705 kb/s
[mp4 @ 0x7fefc7046400] Could not find tag for codec prores in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
  Stream #2:0 -> #0:2 (copy)
    Last message repeated 1 times

I do not have a .mov offhand that has "French, Middle" audio language descriptor, but I'm working to see if I can get ahold of one.

comment:4 by jeanhackman, 5 years ago

However, I was just successful in creating an MPEG-TS container with MPEG-2 video and AAC audio including the "frm" audio language descriptor. I think this will suffice for the testing I am performing. I'm assuming passing "frm" audio language descriptor is either a limitation of the MPEG-4 container ".mov" or a limitation within ffmpeg currently.

ffmpeg -i test_pattern.mov \
-i french_5.1_audio/5.1_pcm_fra.aiff \
-i stereo_pcm_fra_dvs_audio.aiff \
-vcodec mpeg2video \
-map 0:v \
-acodec aac \
-map 1:a -metadata:s:a:0 language=fra \
-map 2:a -metadata:s:a:1 language=frm \
audio_map_test_files/test_pattern_fra51_fraDVS.ts
mediainfo audio_map_test_files/test_pattern_fra51_fraDVS.ts
...
Audio #2
ID                                       : 258 (0x102)
Menu ID                                  : 1 (0x1)
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Format version                           : Version 4
Muxing mode                              : ADTS
Codec ID                                 : 15-2
Duration                                 : 1 s 857 ms
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 22.05 kHz
Frame rate                               : 21.533 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -46 ms
Language                                 : frm

in reply to:  4 comment:5 by Carl Eugen Hoyos, 5 years ago

Replying to jeanhackman:

However, I was just successful in creating an MPEG-TS container with MPEG-2 video and AAC audio including the "frm" audio language descriptor.

If you remux this file to mp4, does the resulting file show the desired language descriptor?

comment:6 by jeanhackman, 5 years ago

yes

ffmpeg -i audio_map_test_files/test_pattern_fra51_fraDVS.ts \
-vcodec copy \
-acodec copy \
-map 0 \
audio_map_test_files/test_pattern_fra51_fraDVS.mp4
mediainfo audio_map_test_files/test_pattern_fra51_fraDVS.mp4
...
Audio #2
...
Language                                 : frm

comment:7 by jeanhackman, 5 years ago

though, full disclosure, I abandoned the first output file created per comment 3 as x264 and ac3 are more applicable for my testing needs. here is the command line used to created the new "test_pattern_fra51_fraDVS.ts" file mentioned in comment 6:

/usr/local/Cellar/ffmpeg/4.1.3_1/bin/ffmpeg -i test_pattern.mov \
-i french_5.1_audio/mono_pcm_fra_front_left_audio.aiff \
-i french_5.1_audio/mono_pcm_fra_front_right_audio.aiff \
-i french_5.1_audio/mono_pcm_fra_front_center_audio.aiff \
-i french_5.1_audio/mono_pcm_fra_lfe_audio.aiff \
-i french_5.1_audio/mono_pcm_fra_rear_left_audio.aiff \
-i french_5.1_audio/mono_pcm_fra_rear_right_audio.aiff \
-i stereo_pcm_fra_dvs_audio.aiff \
-vcodec libx264 \
-map 0:v \
-acodec ac3 \
-map 1:a -metadata:s:a:0 language=fra \
-map 2:a -metadata:s:a:1 language=fra \
-map 3:a -metadata:s:a:2 language=fra \
-map 4:a -metadata:s:a:3 language=fra \
-map 5:a -metadata:s:a:4 language=fra \
-map 6:a -metadata:s:a:5 language=fra \
-map 7:a -metadata:s:a:6 language=frm \
audio_map_test_files/test_pattern_fraPCM_51_fraDVS.ts

comment:8 by Carl Eugen Hoyos, 5 years ago

What is the actual application that you use to see the language description?

comment:9 by jeanhackman, 5 years ago

mediainfo --version
MediaInfo Command line,
MediaInfoLib - v18.12
Last edited 5 years ago by jeanhackman (previous) (diff)

comment:10 by Carl Eugen Hoyos, 5 years ago

No, I doubt that mediainfo can be used to do anything useful with a media file, my question is what actual application are you using?

in reply to:  10 comment:11 by jeanhackman, 5 years ago

Replying to cehoyos:

No, I doubt that mediainfo can be used to do anything useful with a media file, my question is what actual application are you using?

I typically use Manzanita MP2TSAE for MPEG-TS container compliance/analysis and sometimes a command line tool that I wrote myself.
Here is output from MP2TSAE while digging into the PMT to look at the French DVS stream:

  Stream #8
    stream_type:	0x81 (User Private)
    reserved:	7
    elementary_PID:	0x107 (263)
    reserved:	15
    ES_info_length:	6
    ISO_639_language_descriptor
      tag:	0x0A (10)
      length:	4
      ISO_639_language_code:	0x66726D (frm)
      audio_type:	0 (Undefined)

As you can see the ISO_639_language_code is present and has value "frm" as expected.
Not that this is the place for debate, but I wholeheartedly disagree with your jab at mediainfo and can vouch that it is actually used in fortune 50, enterprise-level production workflows. As you can see, mediainfo in this case accurately represents the language code.

comment:12 by Marton Balint, 5 years ago

Cc: Marton Balint added

As far as I see QuickTime only supports Macintosh language codes:

https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html

FRM is not among those. Is there an application which generates a quicktime file with frm language?

Last edited 5 years ago by Marton Balint (previous) (diff)

comment:14 by Marton Balint, 5 years ago

There is a note however in the specs:

Note: ISO language codes cannot be used for all elements of a QuickTime file. Currently, ISO language codes can be used only for user data text. All other elements, including text tracks, must be specified using Macintosh language codes.

So using extended language tags is the only way to support this?

in reply to:  14 comment:15 by jeanhackman, 5 years ago

Replying to cus:

There is a note however in the specs:

Note: ISO language codes cannot be used for all elements of a QuickTime file. Currently, ISO language codes can be used only for user data text. All other elements, including text tracks, must be specified using Macintosh language codes.

So using extended language tags is the only way to support this?

Looks to be so, yes. Thanks for adding links to the documentation.

comment:16 by llogan, 3 years ago

Summary: ISO 639-2 Code "frm" SupportSupport Extended Language Tag Atom (elng) for MOV muxer

Related abandoned patch:

avformat/isom: allow ISO 639 codes for mov
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200620001006.159305-1-yonglel@google.com/

Note: See TracTickets for help on using tickets.