Opened 5 years ago

Closed 5 years ago

#1953 closed defect (fixed)

Conflict with tags when copying streams from WAV files

Reported by: jamal Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: voc flv
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Muxers containing AVCodecTag entries with tag value 0 (aside from codec_id_none) and/or 1 will apparently fail to copy a stream from a wav file with different results depending on the presence of each of those values.

How to reproduce:

Get any pcm_u8 wav sample:

% ffmpeg -i pcmu8.wav -c:a copy pcmu8.voc

The output will show something like this:

$ ./ffmpeg -i asd.wav -c:a copy ads.voc
ffmpeg version N-47005-g3616afc Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 22 2012 22:43:13 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-memory-poisoning --enable-cross-compile --cross-prefix=x86_64-w64-mingw32- --target-os=mingw32 --arch=x86_64 --prefix=/mingw64
  libavutil      52.  8.100 / 52.  8.100
  libavcodec     54. 76.100 / 54. 76.100
  libavformat    54. 37.100 / 54. 37.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.102 /  3. 23.102
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
[wav @ 000000000025DBA0] max_analyze_duration 5000000 reached at 5015510
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wav, from 'asd.wav':
  Metadata:
    encoder         : Lavf54.37.100
  Duration: 00:00:22.80, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 44100 Hz, stereo, u8, 705 kb/s
File 'ads.voc' already exists. Overwrite ? [y/N] y
Tag [1][0][0][0]/0x00000001 incompatible with output codec id '65541' ([0][0][0][0])
Output #0, voc, to 'ads.voc':
  Metadata:
    encoder         : Lavf54.37.100
    Stream #0:0: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 44100 Hz, stereo, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input

The AVCodecTag list from the voc muxer contains tag entry 0 for PCM_U8, so it should work.

In short, if a muxer's AVCodecTag list contains both tag entries 0 and 1, or a tag entry 0 but no tag entry 1, or vice-versa, different codecs will fail to copy with this same error and others will succeed (Or rather, the write_header code from the muxer will be executed as it should).

Change History (3)

comment:1 Changed 5 years ago by cehoyos

  • Keywords wav removed
  • Reproduced by developer set
  • Status changed from new to open

The problem is to have an entry with tag==0 for the copied codec and an entry that matches the riff entry for the original codec.

comment:2 Changed 5 years ago by cehoyos

  • Keywords voc flv added

Also reproducible with flv:

$ make fate-acodec-pcm-u8
...
$ ./ffmpeg -i tests/data/fate/acodec-pcm-u8.wav -acodec copy out.flv
ffmpeg version N-47157-gb0d9b01 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 28 2012 12:41:39 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52.  9.102 / 52.  9.102
  libavcodec     54. 77.100 / 54. 77.100
  libavformat    54. 38.100 / 54. 38.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.104 /  3. 23.104
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
[wav @ 0x24f0240] max_analyze_duration 5000000 reached at 5015510
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wav, from 'tests/data/fate/acodec-pcm-u8.wav':
  Duration: 00:00:06.00, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 44100 Hz, stereo, u8, 705 kb/s
[flv @ 0x25586e0] Tag [1][0][0][0]/0x00000001 incompatible with output codec id '65541' ([0][0][0][0])
Output #0, flv, to 'out.flv':
    Stream #0:0: Audio: pcm_u8 ([1][0][0][0] / 0x0001), 44100 Hz, stereo, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input

comment:3 Changed 5 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

Should be fixed in current git head.

Note: See TracTickets for help on using tickets.