Opened 13 years ago

Closed 12 years ago

#867 closed defect (fixed)

support in24 audio in mov muxer

Reported by: dave rice Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: atag mov
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

In order to maintain interoperability with a broadcast system I need to transcode audio to pcm_s24be with an 'in24' codecid. Using ffmpeg the codecid for '-acodec pcm_s24be' produces a codecid of 'lpcm' even if I specify '-atag in24'

Here's my output using ffmpeg to try to output an 'in24' audio stream in Quicktime:

ffmpeg -i MI-351_8b.mov -vn -acodec pcm_s24be -atag in24 in24.mov
ffmpeg version N-32741-g440e984, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec 27 2011 09:48:51 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-libfreetype --enable-nonfree --enable-hardcoded-tables --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid
  libavutil      51. 33.100 / 51. 33.100
  libavcodec     53. 48.100 / 53. 48.100
  libavformat    53. 28.100 / 53. 28.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 55.100 /  2. 55.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  5.100
  libpostproc    51.  2.100 / 51.  2.100

Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MI-351_8b.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.14.0
  Duration: 00:00:13.03, start: 0.000000, bitrate: 169865 kb/s
    Stream #0:0(eng): Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x486, 167793 kb/s, SAR 9:10 DAR 4:3, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : 
                        DataHandler
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 2 channels, s32, 2304 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : 
                        DataHandler
Output #0, mov, to 'in24.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.28.100
    Stream #0:0(eng): Audio: pcm_s24be (in24 / 0x34326E69), 48000 Hz, 2 channels, s32, 2304 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : 
                        DataHandler
Stream mapping:
  Stream #0:1 -> #0:0 (pcm_s24le -> pcm_s24be)
Press [q] to stop, [?] for help
size=    3666kB time=00:00:13.03 bitrate=2304.4kbits/s    
video:0kB audio:3665kB global headers:0kB muxing overhead 0.018598%

Checking the file shows the fourcc is 'lpcm':

ffmpeg -i in24.mov
ffmpeg version N-32741-g440e984, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec 27 2011 09:48:51 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-libfreetype --enable-nonfree --enable-hardcoded-tables --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid
  libavutil      51. 33.100 / 51. 33.100
  libavcodec     53. 48.100 / 53. 48.100
  libavformat    53. 28.100 / 53. 28.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 55.100 /  2. 55.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  5.100
  libpostproc    51.  2.100 / 51.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in24.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.28.100
  Duration: 00:00:13.03, start: 0.000000, bitrate: 2304 kb/s
    Stream #0:0(eng): Audio: pcm_s24be (lpcm / 0x6D63706C), 48000 Hz, 2 channels, s32, 2304 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : 
                        DataHandler
At least one output file must be specified

The same command through ffmbc works and produces an output with 'in24' codec id.

Attachments (2)

SoudieF_ffmpeg_in24.mov (1.4 MB ) - added by dave rice 13 years ago.
force in24 with ffmpeg
SoundieF_ffmbc_in24.mov (1.4 MB ) - added by dave rice 13 years ago.
force in24 with ffmbc

Change History (9)

comment:1 by Carl Eugen Hoyos, 13 years ago

Component: undeterminedavformat
Keywords: mov added
Reproduced by developer: set
Status: newopen

(Where do you try to force a video tag?)

Does the following work-around allow to produce correct files for you, no -tag needed?

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e5f0c4c..9635c92 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -464,7 +464,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
     uint32_t tag = track->tag;

     if (track->mode == MODE_MOV) {
-        if (mov_get_lpcm_flags(track->enc->codec_id))
+        if (!tag && mov_get_lpcm_flags(track->enc->codec_id))
             tag = AV_RL32("lpcm");
         version = 2;
     }

comment:2 by Carl Eugen Hoyos, 13 years ago

Could you test this patch?
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/138633

QuickTime does not read "in24" here, so the resulting file does not play for me on OSX.

comment:3 by dave rice, 13 years ago

Hi, I tested the patch a few days ago and it didn't seem to work. QuickTime played the audio back as silence whereas the same -atag command with ffmbc worked. I'll redo the test today with patched ffmpeg and ffmbc to provide samples and outputs. Thanks.

comment:4 by dave rice, 13 years ago

So this patch does force the output to use the 'in24' codec id; however the resulting file plays out as silence or a faint buzz sound.

Here's the ffmpeg report

ffmpeg started on 2012-01-18 at 00:04:21
Report written to "ffmpeg-20120118-000421.log"
Command line:
./ffmpeg -y -report -i SoundieF.mpeg -ss 10 -t 5 -vn -acodec pcm_s24le -atag in24 SoudieF_ffmpeg_in24.mov
ffmpeg version N-36769-gb18e17e Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 12 2012 21:51:39 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
  configuration: 
  libavutil      51. 34.100 / 51. 34.100
  libavcodec     53. 55.100 / 53. 55.100
  libavformat    53. 29.100 / 53. 29.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 59.100 /  2. 59.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
[mpeg @ 0x7fd570828a00] Format mpeg probed with size=4096 and score=52
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2500
[mpeg @ 0x7fd570828a00] Probe with size=794, packets=1 detected mpegvideo with score=25
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2499
[mpeg @ 0x7fd570828a00] Probe with size=2809, packets=2 detected mpegvideo with score=25
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2498
[mpeg @ 0x7fd570828a00] Probe with size=4824, packets=3 detected mpegvideo with score=25
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2497
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2496
[mpeg @ 0x7fd570828a00] Probe with size=8854, packets=5 detected mpegvideo with score=25
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2495
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2494
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2493
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2492
[mpeg @ 0x7fd570828a00] Probe with size=16914, packets=9 detected mpegvideo with score=25
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2491
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2490
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2489
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2488
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2487
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2486
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2485
[mpeg @ 0x7fd570828a00] probing stream 0 pp:2484
[mpeg @ 0x7fd570828a00] Probe with size=33034, packets=17 detected mpegvideo with score=51
[mpeg @ 0x7fd570828a00] probed stream 0
[mpeg2video @ 0x7fd570831000] err{or,}_recognition separate: 1; 1
[mpeg2video @ 0x7fd570831000] err{or,}_recognition combined: 1; 10001
[mpeg2video @ 0x7fd570831000] detected 2 logical cores
[mpeg2video @ 0x7fd570831000] Unsupported bit depth: 0
[mp2 @ 0x7fd570830a00] err{or,}_recognition separate: 1; 1
[mp2 @ 0x7fd570830a00] err{or,}_recognition combined: 1; 10001
[mpeg @ 0x7fd570828a00] max_analyze_duration 5000000 reached at 5005000
Input #0, mpeg, from 'SoundieF.mpeg':
  Duration: 00:02:24.10, start: 839.378778, bitrate: 3786 kb/s
    Stream #0:0[0x1e0], 152, 1/90000: Video: mpeg2video (Main), yuv420p, 352x480 [SAR 20:11 DAR 4:3], 3500 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1c0], 193, 1/90000: Audio: mp2, 48000 Hz, stereo, s16, 224 kb/s
Incompatible sample format 's16' for codec 'pcm_s24le', auto-selecting format 's32'
[pcm_s24le @ 0x7fd570831c00] err{or,}_recognition separate: 1; 1
[pcm_s24le @ 0x7fd570831c00] err{or,}_recognition combined: 1; 10001
[mp2 @ 0x7fd570830a00] err{or,}_recognition separate: 1; 10001
[mp2 @ 0x7fd570830a00] err{or,}_recognition combined: 1; 10001
Output #0, mov, to 'SoudieF_ffmpeg_in24.mov':
  Metadata:
    encoder         : Lavf53.29.100
    Stream #0:0, 0, 1/48000: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mp2 -> pcm_s24le)
Press [q] to stop, [?] for help
size=    1405kB time=00:00:04.99 bitrate=2305.2kbits/s    
video:0kB audio:1404kB global headers:0kB muxing overhead 0.051193%

I tested the same equivalent command in ffmbc which did produce a playable file. Here's the ffmbc output

ffmbc -y -i SoundieF.mpeg -ss 10 -t 5 -vn -acodec pcm_s24le -atag in24 SoundieF_ffmbc_in24.mov
FFmbc version 0.7-rc4
Copyright (c) 2008-2011 Baptiste Coudurier and the FFmpeg developers
Input #0, mpeg, from 'SoundieF.mpeg':
 Duration: 00:02:24.11, start: 839.368778, bitrate: 3786 kb/s
   Stream #0.0[0x1e0](und): Video: mpeg2video (Main), yuv420p, 352x480i tff [PAR 20:11 DAR 4:3], 3500 kb/s, 29.97 fps
   Stream #0.1[0x1c0](und): Audio: mp2, 48000 Hz, stereo, s16, 224 kb/s
Incompatible sample format 's16' for codec 'pcm_s24le', auto-selecting format 's32'
Output #0, mov, to 'SoundieF_ffmbc_in24.mov':
 Metadata:
   encoder: FFmbc 0.7
   Stream #0.0(und): Audio: pcm_s24le, 48000 Hz, stereo, s32, 2304 kb/s
Stream mapping:
 Stream #0.1 -> #0.0
Press [q] to stop, [?] for help
adding 863 audio samples in stream #0.1
[mov @ 0x7f9309000c00] replacing header in front, copying  1.38MB                                                          
size=    1411kB time=00:00:05.00 bitrate=2306.5kbits/s    
video:0kB audio:1409kB global headers:0kB muxing overhead 0.107009%

I'll attach the output files to the ticket. Perhaps the ticket should be renamed to 'support in24 audio'.

by dave rice, 13 years ago

Attachment: SoudieF_ffmpeg_in24.mov added

force in24 with ffmpeg

by dave rice, 13 years ago

Attachment: SoundieF_ffmbc_in24.mov added

force in24 with ffmbc

comment:5 by Michael Niedermayer, 12 years ago

Summary: -tag:[v|a] doesn't force a fourccsupport in24 audio in mov muxer

-v/atag certainly work with avi for example, so changing the title according to the suggestion

comment:6 by dave rice, 12 years ago

Not exactly sure when this was fixed, but when I now try to replicate the commands I originally posted the output is as expected.

ffmpeg -i fcp_capture2.mov -vn -acodec pcm_s24be -atag in24 in24.mov
ffmpeg version 1.0.git Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 18 2012 23:49:10 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-ffplay
  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 80.100 / 54. 80.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 28.102 /  3. 28.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8b5080f200] Stream #1: not enough frames to estimate rate; consider increasing probesize
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8b5080f200] Stream #2: not enough frames to estimate rate; consider increasing probesize
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8b5080f200] Stream #3: not enough frames to estimate rate; consider increasing probesize
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8b5080f200] Stream #4: not enough frames to estimate rate; consider increasing probesize
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8b5080f200] Stream #5: not enough frames to estimate rate; consider increasing probesize
Guessed Channel Layout for  Input Stream #0.2 : stereo
Guessed Channel Layout for  Input Stream #0.3 : mono
Guessed Channel Layout for  Input Stream #0.4 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fcp_capture2.mov':
  Metadata:
    creation_time   : 2012-11-29 21:23:35
    timecode        : 01:26:27;06
  Duration: 00:00:00.40, start: 0.098771, bitrate: 216637 kb/s
    Stream #0:0(eng): Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x486, 136674 kb/s, 24.41 fps, 29.97 tbr, 2997 tbn, 2997 tbc
    Metadata:
      creation_time   : 2012-11-29 21:23:36
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Subtitle: eia_608 (c608 / 0x38303663)
    Metadata:
      creation_time   : 2012-11-29 21:23:36
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s
    Metadata:
      creation_time   : 2012-11-29 21:23:36
      handler_name    : Apple Alias Data Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      creation_time   : 2012-11-29 21:23:36
      handler_name    : Apple Alias Data Handler
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32, 1152 kb/s
    Metadata:
      creation_time   : 2012-11-29 21:23:36
      handler_name    : Apple Alias Data Handler
    Stream #0:5(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      creation_time   : 2012-11-29 21:23:36
      handler_name    : Apple Alias Data Handler
      timecode        : 01:26:27;06
Output #0, mov, to 'in24.mov':
  Metadata:
    timecode        : 01:26:27;06
    encoder         : Lavf54.49.102
    Stream #0:0(eng): Audio: pcm_s24be (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s
    Metadata:
      creation_time   : 2012-11-29 21:23:36
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:2 -> #0:0 (pcm_s24le -> pcm_s24be)
Press [q] to stop, [?] for help
size=     134kB time=00:00:00.57 bitrate=1916.9kbits/s    
video:0kB audio:133kB subtitle:0 global headers:0kB muxing overhead 0.551449%

Then read back the output

ffmpeg -i in24.mov 
ffmpeg version 1.0.git Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 18 2012 23:49:10 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-ffplay
  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 80.100 / 54. 80.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 28.102 /  3. 28.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in24.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf54.49.102
  Duration: 00:00:00.47, start: 0.098000, bitrate: 2314 kb/s
    Stream #0:0(eng): Audio: pcm_s24be (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s
    Metadata:
      handler_name    : DataHandler
At least one output file must be specified

The result is the same if I omit the -atag in24, the output defaults to the in24 fourcc. It appears that in24 is now supported in the mov muxer.

comment:7 by Carl Eugen Hoyos, 12 years ago

Resolution: fixed
Status: openclosed

This was fixed in January by Michael, thank you for testing again!

Note: See TracTickets for help on using tickets.