[Libav-user] Wrong duration of AAC files encoded by iTunes 12.3.0

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] Wrong duration of AAC files encoded by iTunes 12.3.0

Uwe Klotz
I've encountered inconsistencies when decoding AAC files encoded by iTunes.

An AAC file encoded by iTunes 12.3.0 reports the following stream properties:
start_time = 2112
duration = 1328128
https://github.com/uklotzde/mixxx/blob/ffmpeg31/src/test/id3-test-data/cover-test-itunes-12.3.0-aac.m4a

The same file encoded by iTunes 12.7.0 reports the following stream properties:
start_time = 0
duration = 1328128
https://github.com/uklotzde/mixxx/blob/ffmpeg31/src/test/id3-test-data/cover-test-itunes-12.7.0-aac.m4a

The actual duration of the first file must be reduced to 1328128 - 2112 =
1326016 for decoding, because the last frame received from FFmpeg ends at
1326016.

Is this inconsistency caused by iTunes or by FFmpeg? As a workaround I need
to reduce the duration of all AAC files by their start_time (if start_time >
0) to avoid running into issues when decoding affected files.

FFmpeg version: ffmpeg-3.3.4-1.fc26.x86_64 (Fedora 26 + RPM Fusion repos)

Kind regards,

Uwe

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Wrong duration of AAC files encoded by iTunes 12.3.0

Carl Eugen Hoyos-2
2017-10-02 14:42 GMT+02:00 Uwe Klotz <[hidden email]>:

> I've encountered inconsistencies when decoding AAC files encoded by iTunes.
>
> An AAC file encoded by iTunes 12.3.0 reports the following stream
> properties:
> start_time = 2112
> duration = 1328128
> https://github.com/uklotzde/mixxx/blob/ffmpeg31/src/test/id3-test-data/cover-test-itunes-12.3.0-aac.m4a
>
> The same file encoded by iTunes 12.7.0 reports the following stream
> properties:
> start_time = 0
> duration = 1328128
> https://github.com/uklotzde/mixxx/blob/ffmpeg31/src/test/id3-test-data/cover-test-itunes-12.7.0-aac.m4a
>
> The actual duration of the first file must be reduced to 1328128 - 2112 =
> 1326016 for decoding, because the last frame received from FFmpeg ends at
> 1326016.

How are you testing this?
Is the issue you see reproducible with the ffmpeg command line tool?

Please test current FFmpeg git head, nothing else is supported here.

Thank you, Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Wrong duration of AAC files encoded by iTunes 12.3.0

Uwe Klotz
Tested again as requested with ffprobe from git HEAD. The actual duration_ts
calculated from the first and last frames is (1327104 + 1024) - 2112 =
1326016 instead of 1328128 as reported for the stream.

Please also notice that the first frame of the file encoded with iTunes
12.3.0 contains only 960 instead of 1024 samples which is consistent with
the actual duration_ts of 1326016.

ffprobe -show_frames
~/Projects/Mixxx/mixxx/src/test/id3-test-data/cover-test-itunes-12.3.0-aac.m4a
(only output for stream with index 0 is shown)
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=1
channel_layout=mono
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=2112
start_time=0.047891
duration_ts=1328128
duration=30.116281
bit_rate=96036
max_bit_rate=107504
bits_per_raw_sample=N/A
nb_frames=1297
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2015-10-08T11:36:47.000000Z
TAG:language=und
[/STREAM]

ffprobe -show_frames
~/Projects/Mixxx/mixxx/src/test/id3-test-data/cover-test-itunes-12.3.0-aac.m4a
(only output for first/last frame of stream with index 0 is shown)
[FRAME]
media_type=audio
stream_index=0
key_frame=1
pkt_pts=2112
pkt_pts_time=0.047891
pkt_dts=2112
pkt_dts_time=0.047891
best_effort_timestamp=2048
best_effort_timestamp_time=0.046440
pkt_duration=960
pkt_duration_time=0.021769
pkt_pos=12423
pkt_size=389
sample_fmt=fltp
nb_samples=960
channels=1
channel_layout=mono
[/FRAME]
...
[FRAME]
media_type=audio
stream_index=0
key_frame=1
pkt_pts=1327104
pkt_pts_time=30.093061
pkt_dts=1327104
pkt_dts_time=30.093061
best_effort_timestamp=1327104
best_effort_timestamp_time=30.093061
pkt_duration=1024
pkt_duration_time=0.023220
pkt_pos=373448
pkt_size=372
sample_fmt=fltp
nb_samples=1024
channels=1
channel_layout=mono
[/FRAME]


On 02.10.2017 14:45, Carl Eugen Hoyos wrote:

> 2017-10-02 14:42 GMT+02:00 Uwe Klotz <[hidden email]>:
>> I've encountered inconsistencies when decoding AAC files encoded by iTunes.
>>
>> An AAC file encoded by iTunes 12.3.0 reports the following stream
>> properties:
>> start_time = 2112
>> duration = 1328128
>> https://github.com/uklotzde/mixxx/blob/ffmpeg31/src/test/id3-test-data/cover-test-itunes-12.3.0-aac.m4a
>>
>> The same file encoded by iTunes 12.7.0 reports the following stream
>> properties:
>> start_time = 0
>> duration = 1328128
>> https://github.com/uklotzde/mixxx/blob/ffmpeg31/src/test/id3-test-data/cover-test-itunes-12.7.0-aac.m4a
>>
>> The actual duration of the first file must be reduced to 1328128 - 2112 =
>> 1326016 for decoding, because the last frame received from FFmpeg ends at
>> 1326016.
> How are you testing this?
> Is the issue you see reproducible with the ffmpeg command line tool?
>
> Please test current FFmpeg git head, nothing else is supported here.
>
> Thank you, Carl Eugen
> _______________________________________________
> Libav-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Wrong duration of AAC files encoded by iTunes 12.3.0

Carl Eugen Hoyos-2
2017-10-02 15:43 GMT+02:00 Uwe Klotz <[hidden email]>:

[...]

Let's try again and please remember not to top-post here
and not to cut the console output.

You are writing in the subject about "wrong duration": How
can I reproduce "wrong duration"? Please try not to answer
with a formula but more with something like "'ffmpeg -i input'
reports a duration of 90 seconds but the input file is actually
100 seconds" or "'ffmpeg -i input output' produces a file with
different length".
Allow me to repeat: Is the issue reproducible with "ffmpeg",
the command line tool or are other tools (like ffprobe) needed
to reproduce?

Thank you, Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user