Opened 4 years ago

Closed 4 years ago

#2605 closed defect (fixed)

Raw audio in MP4 container

Reported by: asukhanov Owned by:
Priority: important Component: avformat
Version: git-master Keywords: mov regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

I found that commit http://ffmpeg.org/pipermail/ffmpeg-cvslog/2012-March/048842.html
breaks MOV demuxing in case if input file has PCM audio inside and wrong STSZ sample_size for this audio trak.

I have a file which I successfully transcoded with ffmpeg before this patch:

Audio trak is PCM signed 16 LE.
Timescale = 44100
num_channels = 2
bits_per_sample = 16

Each sample duration = 1, so Each sample size should be = num_channels * bits_per_sample / 8 * duration = 4 bytes
But STSZ wrongly has sample_size = 1 byte.

I uploaded file on ftp://upload.ffmpeg.org:
audio_silence_after_ffmpeg_upgrade.mov

Before this patch http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=50059bde77674977d9134f3c1151a63cb7a2391c
ffmpeg was able to fix this stream error and decode audio successfully.

How to reproduce:

% ffplay audio_silence_after_ffmpeg_upgrade.mov

ffplay version git-2013-05-15-1a36c75 Copyright (c) 2003-2013 the FFmpeg developers

built on May 14 2013 19:05:26 with gcc 4.6 (Ubuntu/Linaro? 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libx264 --enable-libfaac --enable-libmp3lame --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
libavutil 52. 31.100 / 52. 31.100
libavcodec 55. 9.100 / 55. 9.100
libavformat 55. 7.100 / 55. 7.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 67.100 / 3. 67.100
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

Change History (5)

comment:1 Changed 4 years ago by asukhanov

I had a chance to do some investigation.

In file I provided to you Audio TRAK has wrong STSZ atom. Sample size must be = 4, but it 1.

Before Patch http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=50059bde77674977d9134f3c1151a63cb7a2391c ffmpeg could find this bug in the stream (as long as it's PCM, we can calculate sample size) and fix it.

Also please take a look on Audio STTS:

EntryCount? 2
Entry[0].SampleCount? 688128
Entry[0].SampleDelta? 0
Entry[1].SampleCount? 0
Entry[1].SampleDelta? 0

As long as we do have 2 entries inside of audio STTS: condition inside of this 'if' statement = true:
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/mov.c;h=d5e1f893f573d794a8a81c4e20dd2ae026034809;hb=HEAD#l1967

so we use alt_sample_size = 1 (incorrect) instead of sample size = 4 (correct)

comment:2 Changed 4 years ago by cehoyos

  • Keywords mov regression added; MOV MP4 demuxer removed
  • Priority changed from normal to important
  • Version changed from unspecified to git-master

comment:3 Changed 4 years ago by michael

patch that fixes this on ffmpeg-devel

comment:4 Changed 4 years ago by cehoyos

  • Reproduced by developer set
  • Status changed from new to open

comment:5 Changed 4 years ago by cehoyos

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

Fixed by Michael.

Note: See TracTickets for help on using tickets.