Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#1174 closed defect (duplicate)

iPod / iPad plays both audio tracks simultaneously

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

Description

This is very similar to portions of what's described in #468.

The input MKV file has one AVC video track and two AC3 audio tracks.

I use this command (in ffmpeg 0.10.2; see below for results with today's git)

ffmpeg -y -i input.mkv -map 0:0 -map 0:1 -map 0:2 -acodec aac -ar 48000 -ab 128k -ac 2 -vcodec copy -strict experimental -threads 6 output.m4v

The process runs, and no errors are reported

ffmpeg started on 2012-04-06 at 15:59:59
Report written to "ffmpeg-20120406-155959.log"
Command line:
ffmpeg -report -y -i input.mkv -map 0:0 -map 0:1 -map 0:2 -acodec aac -ar 48000 -ab 128k -ac 2 -vcodec copy -strict experimental -threads 6 output.m4v
ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar 24 2012 15:22:08 with gcc 4.5.1 20100924 (Red Hat 4.5.1-4)
  configuration:
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
[matroska,webm @ 0xa058280] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
st:2 removing common factor 1000000 from timebase
st:3 removing common factor 1000000 from timebase
st:4 removing common factor 1000000 from timebase
st:5 removing common factor 1000000 from timebase
[h264 @ 0xa05f4c0] err{or,}_recognition separate: 1; 1
[h264 @ 0xa05f4c0] err{or,}_recognition combined: 1; 10001
[ac3 @ 0xa05fb60] err{or,}_recognition separate: 1; 1
[ac3 @ 0xa05fb60] err{or,}_recognition combined: 1; 10001
[ac3 @ 0xa05fb60] Unsupported bit depth: 0
[ac3 @ 0xa060140] err{or,}_recognition separate: 1; 1
[ac3 @ 0xa060140] err{or,}_recognition combined: 1; 10001
[ac3 @ 0xa060140] Unsupported bit depth: 0
[dvdsub @ 0xa079a00] err{or,}_recognition separate: 1; 1
[dvdsub @ 0xa079a00] err{or,}_recognition combined: 1; 10001
[dvdsub @ 0xa079a00] palette: 0x0000fd 0xfe0000 0x000000 0xfdfdfd 0xf38200 0x0087f4 0xf6ea8a 0x007c7b 0x0000fd 0xfeea04 0x7b0000 0x007e00 0x00007a 0xdc00fd 0xdd7d00 0xdfe13a
[dvdsub @ 0xa07fc80] err{or,}_recognition separate: 1; 1
[dvdsub @ 0xa07fc80] err{or,}_recognition combined: 1; 10001
[dvdsub @ 0xa07fc80] palette: 0x0000fd 0xfe0000 0x000000 0xfdfdfd 0xf38200 0x0087f4 0xf6ea8a 0x007c7b 0x0000fd 0xfeea04 0x7b0000 0x007e00 0x00007a 0xdc00fd 0xdd7d00 0xdfe13a
[h264 @ 0xa05f4c0] no picture
[h264 @ 0xa05f4c0] no picture
[matroska,webm @ 0xa058280] All info found
rfps: 29.666667 0.013781
rfps: 29.666667 0.013781
rfps: 29.750000 0.007295
rfps: 29.750000 0.007295
rfps: 29.833333 0.002869
rfps: 29.833333 0.002869
rfps: 29.916667 0.000504
rfps: 29.916667 0.000504
rfps: 30.000000 0.000199
rfps: 30.083333 0.001955
rfps: 30.166667 0.005771
rfps: 30.250000 0.011647
rfps: 30.333333 0.019584
rfps: 30.333333 0.019584
rfps: 59.583333 0.019298
rfps: 59.666667 0.011477
rfps: 59.666667 0.011477
rfps: 59.750000 0.005717
rfps: 59.750000 0.005717
rfps: 59.833333 0.002017
rfps: 59.833333 0.002017
rfps: 59.916667 0.000377
rfps: 59.916667 0.000377
rfps: 29.970030 0.000072
rfps: 29.970030 0.000072
rfps: 59.940060 0.000287
rfps: 59.940060 0.000287
Input #0, matroska,webm, from 'input.mkv':
  Duration: 00:22:01.32, start: 0.000000, bitrate: 1705 kb/s
    Chapter #0.0: start 0.000000, end 330.330000
    Metadata:
      title           : Chapter 1
    Chapter #0.1: start 330.330000, end 859.325133
    Metadata:
      title           : Chapter 2
    Chapter #0.2: start 859.325133, end 1295.360733
    Metadata:
      title           : Chapter 3
    Chapter #0.3: start 1295.360733, end 1321.320000
    Metadata:
      title           : Chapter 4
    Stream #0:0(eng), 43, 1/1000: Video: h264 (Main), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 1k tbn, 180k tbc (default)
    Stream #0:1(eng), 46, 1/1000: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s (default)
    Stream #0:2(eng), 46, 1/1000: Audio: ac3, 48000 Hz, mono, s16, 96 kb/s
    Stream #0:3(eng), 0, 1/1000: Subtitle: dvd_subtitle
    Stream #0:4(eng), 0, 1/1000: Subtitle: dvd_subtitle
    Stream #0:5(eng), 0, 1/1000: Subtitle: text
Incompatible sample format 's16' for codec 'aac', auto-selecting format 'flt'
Incompatible sample format 's16' for codec 'aac', auto-selecting format 'flt'
[aac @ 0xa0e4c80] err{or,}_recognition separate: 1; 1
[aac @ 0xa0e4c80] err{or,}_recognition combined: 1; 10001
[aac @ 0xa0e4c80] Unsupported bit depth: 0
[aac @ 0xa0a5340] err{or,}_recognition separate: 1; 1
[aac @ 0xa0a5340] err{or,}_recognition combined: 1; 10001
[aac @ 0xa0a5340] Unsupported bit depth: 0
[ac3 @ 0xa05fb60] err{or,}_recognition separate: 1; 10001
[ac3 @ 0xa05fb60] err{or,}_recognition combined: 1; 10001
[ac3 @ 0xa05fb60] Unsupported bit depth: 0
[ac3 @ 0xa060140] err{or,}_recognition separate: 1; 10001
[ac3 @ 0xa060140] err{or,}_recognition combined: 1; 10001
[ac3 @ 0xa060140] Unsupported bit depth: 0
Output #0, ipod, to 'output.m4v':
  Metadata:
    encoder         : Lavf53.32.100
    Chapter #0.0: start 0.000000, end 330.330000
    Metadata:
      title           : Chapter 1
    Chapter #0.1: start 330.330000, end 859.325133
    Metadata:
      title           : Chapter 2
    Chapter #0.2: start 859.325133, end 1295.360733
    Metadata:
      title           : Chapter 3
    Chapter #0.3: start 1295.360733, end 1321.320000
    Metadata:
      title           : Chapter 4
    Stream #0:0(eng), 0, 1/1000: Video: h264 (avc1 / 0x31637661), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, 29.97 fps, 1k tbn, 1k tbc (default)
    Stream #0:1(eng), 0, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels, flt, 128 kb/s (default)
    Stream #0:2(eng), 0, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels, flt, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (ac3 -> aac)
  Stream #0:2 -> #0:2 (ac3 -> aac)
Press [q] to stop, [?] for help
Input stream #0:1 frame changed from rate:48000 fmt:s16 ch:6 to rate:48000 fmt:s16 ch:2
0.707107
0.707107
frame=39600 fps=242 q=-1.0 Lsize=  236894kB time=00:22:01.22 bitrate=1468.8kbits/s
video:193780kB audio:41301kB global headers:0kB muxing overhead 0.770842%

But when I watch these files on iPod Touch or iPad (both running iOS 5.1) BOTH audio tracks play simultaneously.

If I access the Audio Track chooser in the video player, NEITHER track is "Checkmarked." If I then select either track, playback is normal.

It just seems like there's no "Default" flag set or something.

I don't understand the M4V format enough to debug in detail.

The same MKV converted to M4V using HandBrake 0.9.5 and the iPad preset works correctly.

I have tried this with multiple files using ffmpeg 0.10.2.
I cannot try with today's GIT (4/6/12) because using the exact same command, I get the error

Application provided invalid, non monotonically increasing dts to muxer in stream 0: -67 >= -67
av_interleaved_write_frame(): Invalid argument

Attachments (1)

Ticket1174_cut.mkv (2.0 MB ) - added by Carl Eugen Hoyos 13 years ago.

Download all attachments as: .zip

Change History (9)

in reply to:  description ; comment:1 by Carl Eugen Hoyos, 13 years ago

Replying to TonyPh12345:

I cannot try with today's GIT (4/6/12) because using the exact same command, I get the error

Application provided invalid, non monotonically increasing dts to muxer in stream 0: -67 >= -67
av_interleaved_write_frame(): Invalid argument

This sounds like a serious regression, please provide a sample.

comment:2 by TonyPh12345, 13 years ago

I've uploaded a file named "Ticket1174.mkv" to the FTP server.
It's the entire file, not a 10M dd since some of the relevant metadata is at the end of the file.

in reply to:  1 comment:3 by TonyPh12345, 13 years ago

Replying to cehoyos:

This sounds like a serious regression, please provide a sample.

Ooops; didn't hit the REPLY button. Trying again.

File uploaded.

by Carl Eugen Hoyos, 13 years ago

Attachment: Ticket1174_cut.mkv added

comment:4 by Carl Eugen Hoyos, 13 years ago

You can use -vcodec mpeg4 instead of -vcodec copy to test if the audio issue is still reproducible with current git head.
Did you test the patch in ticket #468? You may need to git checkout 62101030c4ff23c61046a70cd27a627dfb0e0e54 to be able to apply the patch.

in reply to:  4 comment:5 by TonyPh12345, 13 years ago

Replying to cehoyos:

You can use -vcodec mpeg4 instead of -vcodec copy to test if the audio issue is still reproducible with current git head.
Did you test the patch in ticket #468? You may need to git checkout 62101030c4ff23c61046a70cd27a627dfb0e0e54 to be able to apply the patch.

Using the -vcodec mpeg4 did indeed allow the GIT clone to run. However, no fix for the audio as-is.

Since I'm a complete git-iot, I just hand-edited the patch from 468 into the two files in the git clone and recompiled... It worked. iPad and iPod both played the file correctly.

Unfortunately, the differences between the GIT and the 0.10.2 are too extreme for me to the just re-use the edited movenc.c and movenc.h in the 10.2 build... won't compile. :(

Is there any branch that would get me far enough to keep using the -vcodec COPY option, while keeping the patch? (-copy runs about 8x faster than re-encoding to MP4... and I have about 3000 files I want to run this against.)

Version 0, edited 13 years ago by TonyPh12345 (next)

comment:6 by TonyPh12345, 13 years ago

Oh, interesting.

Just as a quick & dirty HACK, all I needed to do was change (in utils.c at line 3138)

if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && st->cur_dts >= pkt->dts)
st->cur_dts > pkt->dts)){

to

if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && st->cur_dts > pkt->dts)
st->cur_dts > pkt->dts)){

(changed the equality to an inequality) to get past the error in the GIT clone.

I realize that's not a "Fix," but it gets me where I need to be.

comment:7 by Elon Musk, 12 years ago

Resolution: fixed
Status: newclosed

This appears to be fixed. Please reopen if not.

comment:8 by Carl Eugen Hoyos, 12 years ago

Component: undeterminedavformat
Keywords: mov added
Resolution: fixedduplicate
Version: 0.10.2git-master

Afaict this is a duplicate of ticket #468, still reproducible with the following command line:

$ ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -i fate-suite/aac/al_sbr_cm_48_5.1.mp4 -map 0:0 -map 0:1 -map 1:0 -acodec aac -strict -2 -vcodec mpeg4 -qscale 5 out.m4v
Note: See TracTickets for help on using tickets.