Opened 14 years ago
Closed 13 years ago
#253 closed defect (needs_more_info)
invalid stream time_base for avi/aac, after av_write_header()
Reported by: | Andrew | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | git-master | Keywords: | avi aac after av_write_header stream time_base |
Cc: | Richard | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Source (mp4/aac):
Duration: 00:00:58.40, start: 0.000000, bitrate: 1154 kb/s
Stream #0.0(eng), 159, 1/32000: Audio: aac, 32000 Hz, stereo, s16, 46 kb/s
Copy stream to mov or mp4:
Stream #0.0(eng), 0, 1/32000: Audio: aac, 32000 Hz, stereo, 46 kb/s
Copy stream to avi:
Stream #0.0(eng), 0, 4/125: Audio: aac, 32000 Hz, stereo, 46 kb/s
Output AVStream->time_base:
before av_write_header() - 1/32000 (good)
after av_write_header() - 4/125 (wrong)
Attachments (4)
Change History (16)
comment:1 by , 14 years ago
Priority: | important → normal |
---|---|
Status: | new → open |
by , 14 years ago
Attachment: | ffmpeg_m4a_to_mov.txt added |
---|
by , 14 years ago
Attachment: | ffmpeg_m4a_to_avi.txt added |
---|
by , 14 years ago
Attachment: | ffprobe_mov.txt added |
---|
by , 14 years ago
Attachment: | ffprobe_avi.txt added |
---|
comment:2 by , 14 years ago
Please add complete, uncut output and command line of the failing command.
Ok, but with another source aac file.
$ ./ffmpeg -debug 1 -i /tmp/track.m4a -acodec copy -y /tmp/test.avi > /tmp/ffmpeg_m4a_to_avi.txt 2>&1
$ ./ffmpeg -debug 1 -i /tmp/track.m4a -acodec copy -y /tmp/test.mov > /tmp/ffmpeg_m4a_to_mov.txt 2>&1
$ ./ffprobe -show_format -show_streams /tmp/test.mov > /tmp/ffprobe_mov.txt 2>&1
$ ./ffprobe -show_format -show_streams /tmp/test.avi > /tmp/ffprobe_avi.txt 2>&1
std{out,err} commands outputs see into the attachment.
comment:3 by , 13 years ago
$ ffmpeg -debug 1 -i fate-suite/aac/al04_44.mp4 -acodec copy out.mov ffmpeg version N-30972-gffc6c8a, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 23 2011 19:31:19 with gcc 4.5.3 configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x12bfd40] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x12bfd40] ISO: File Type Major Brand: mp42 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x12bfd40] All info found Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/aac/al04_44.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2004-02-19 14:38:56 Duration: 00:00:08.24, start: 0.000000, bitrate: 67 kb/s Stream #0.0(und), 1, 1/44100: Audio: aac, 44100 Hz, 1 channels, s16, 63 kb/s Metadata: creation_time : 2004-02-19 14:38:56 Output #0, mov, to 'out.mov': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2004-02-19 14:38:56 encoder : Lavf53.4.0 Stream #0.0(und), 0, 1/44100: Audio: aac, 44100 Hz, 1 channels, 63 kb/s Metadata: creation_time : 2004-02-19 14:38:56 Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop, [?] for help size= 68kB time=00:00:08.24 bitrate= 67.4kbits/s video:0kB audio:64kB global headers:0kB muxing overhead 5.423580%
$ ffmpeg -debug 1 -i fate-suite/aac/al04_44.mp4 -acodec copy out.avi ffmpeg version N-30972-gffc6c8a, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 23 2011 19:31:19 with gcc 4.5.3 configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x12bfd40] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x12bfd40] ISO: File Type Major Brand: mp42 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x12bfd40] All info found Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/aac/al04_44.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2004-02-19 14:38:56 Duration: 00:00:08.24, start: 0.000000, bitrate: 67 kb/s Stream #0.0(und), 1, 1/44100: Audio: aac, 44100 Hz, 1 channels, s16, 63 kb/s Metadata: creation_time : 2004-02-19 14:38:56 Output #0, avi, to 'out.avi': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isom creation_time : 2004-02-19 14:38:56 ISFT : Lavf53.4.0 Stream #0.0(und), 0, 256/11025: Audio: aac, 44100 Hz, 1 channels, 63 kb/s Metadata: creation_time : 2004-02-19 14:38:56 Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop, [?] for help size= 78kB time=00:00:08.24 bitrate= 77.9kbits/s video:0kB audio:64kB global headers:0kB muxing overhead 21.826379%
follow-up: 5 comment:4 by , 13 years ago
I think I am seeing the same issue , trying to convert to AC3 inside AVI container.
Regardless if I use 2 channel or 6 channel, i get 4/125 for audio stream time_base. unfortunately, when playing on an xbox360, only the 2 channel will play, and the 6 channel will fail. i have another video which does play on the xbox360 (which I did not encode), it has 6 channels, sample_rate=48000.000000, and time_base=1/56000. so it is possible to play 6 channel ac3 on the xbox360 in the avi format.
this is the failing video:
ffmpeg -i '/mnt/storage/tmp/Input.mkv' -map 0.0 -vcodec libxvid -vtag XVID -qmin 1.1 -qmax 45 -b 10000k -bt 4500k -maxrate 15000k -bufsize 20000k -level 5 -bf 1 -vsync 1 -sn -async 1000 -map 0.1 -acodec ac3_fixed -ac 6 -ab 448k -ar 48000 -channel_layout 1551 -f avi -y 'Output.avi'
ffmpeg version N-31897-g10b7b4a, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 14 2011 22:10:45 with gcc 4.4.3
configuration: --disable-static --enable-shared --enable-gpl --enable-nonfree --disable-stripping --enable-postproc --enable-runtime-cpudetect --enable-libfaac --enable-libmp3lame --enable-zlib --enable-libvorbis --enable-libopenjpeg --enable-libspeex --enable-libdirac --enable-libtheora --enable-libschroedinger --enable-libx264 --enable-libvpx --enable-libxvid --disable-ffserver
libavutil 51. 12. 0 / 51. 12. 0
libavcodec 53. 10. 0 / 53. 10. 0
libavformat 53. 7. 0 / 53. 7. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 31. 1 / 2. 31. 1
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
[matroska,webm @ 0x2557640] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 47.95 (20000000/417083) -> 23.98 (24000/1001)
Input #0, :
Duration: 00:55:41.25, start: 0.000000, bitrate: 1536 kb/s
Stream #0.0(eng): Video: h264 (High), yuv420p, 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0.1(eng): Audio: dca (DTS), 48000 Hz, 5.1, s16, 1536 kb/s (default)
[buffer @ 0x255c740] w:1280 h:720 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
Output #0, avi,:
Metadata:
Stream #0.0(eng): Video: mpeg4, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=1-45, 10000 kb/s, 23.98 tbn, 23.98 tbc (default)
Stream #0.1(eng): Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s (default)
Stream mapping:
ffprobe -show_streams Output.avi
[mpeg4 @ 0xc9a6c0] Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, :
Metadata:
encoder : Lavf53.7.0
Duration: 00:03:16.35, start: 0.000000, bitrate: 10264 kb/s
Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
[STREAM]
index=0
codec_name=mpeg4
codec_long_name=MPEG-4 part 2
codec_type=video
codec_time_base=1001/24000
codec_tag_string=XVID
codec_tag=0x44495658
width=1280
height=720
has_b_frames=1
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=5
r_frame_rate=24000/1001
avg_frame_rate=0/0
time_base=1001/24000
start_time=0.000000
duration=196.321125
nb_frames=4707
STREAM
[STREAM]
index=1
codec_name=ac3
codec_long_name=ATSC A/52A (AC-3)
codec_type=audio
codec_time_base=0/1
codec_tag_string=[0] [0][0]
codec_tag=0x2000
sample_rate=48000.000000
channels=6
bits_per_sample=0
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=4/125
start_time=0.000000
duration=196.352000
nb_frames=6136
STREAM
comment:5 by , 13 years ago
Replying to rhuddusa:
I think I am seeing the same issue , trying to convert to AC3 inside AVI container.
Regardless if I use 2 channel or 6 channel, i get 4/125 for audio stream time_base. unfortunately, when playing on an xbox360, only the 2 channel will play, and the 6 channel will fail.
It sounds as if the problems are not related.
Please confirm if the working 6 channel file is using a WAVEFORMATEX header or not (or open a new ticket attaching a short working sample).
comment:6 by , 13 years ago
i hope my verbose posting doesn't make you think i know what i'm really doing here :)
how would i check for the WAVEFORMATEX header in an existing video file?
comment:7 by , 13 years ago
So please open a new ticket and attach a short sample of a working 6 channel file.
comment:8 by , 13 years ago
unfortunately, i don't have a public sample available right now, but when i do, i will open a new ticket and attach a short sample
only other information i can add, is that if i do a ffmpeg with vcodec copy, acodec copy, on my working AVI/ac3 6 channel file
[STREAM]
index=1
codec_name=ac3
codec_long_name=ATSC A/52A (AC-3)
codec_type=audio
codec_time_base=0/1
codec_tag_string=[0] [0][0]
codec_tag=0x2000
sample_rate=48000.000000
channels=6
bits_per_sample=0
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/56000
start_time=0.000000
duration=N/A
nb_frames=303959040
STREAM
the output is with format avi:
[STREAM]
index=1
codec_name=ac3
codec_long_name=ATSC A/52A (AC-3)
codec_type=audio
codec_time_base=0/1
codec_tag_string=[0] [0][0]
codec_tag=0x2000
sample_rate=48000.000000
channels=6
bits_per_sample=0
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=4/125
start_time=0.000000
duration=2475.520000
nb_frames=77360
STREAM
and the output is with format mov:
[STREAM]
index=1
codec_name=ac3
codec_long_name=ATSC A/52A (AC-3)
codec_type=audio
codec_time_base=0/1
codec_tag_string=ac-3
codec_tag=0x332d6361
sample_rate=48000.000000
channels=6
bits_per_sample=0
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_time=0.000000
duration=2453.248000
nb_frames=76664
STREAM
so that's my theory that this is specific to avi, i get that time_base=4/125, but works correctly under mov format where i get a time_base=1/48000. i can't find a way to change the resulting avi time_base value
but unfortunately, the xbox 360 only takes 6 channel audio with AVI and ac3
sorry to complain without an actual test case ... i'll work on providing one
comment:9 by , 13 years ago
i should note, i cancelled the ffmpeg operation part way through each of the conversions, so the nb_frames is useless
comment:10 by , 13 years ago
I would like to support you on this issue (it was discussed very often in the past, if it is really true that the xbox only supports broken avi files, there at least is a chance that the relevant FFmpeg code gets changed), but you absolutely have to open a new ticket!
comment:11 by , 13 years ago
About the original issue, could you please explain what does not work ?
The timebase looks perfectly valid to me.
comment:12 by , 13 years ago
Cc: | added |
---|---|
Resolution: | → needs_more_info |
Status: | open → closed |
Concerning the original issue, I am closing this ticket, please reopen if you can provide the missing information.
Concerning the problem with multichannel ac3-in-avi on xbox 360: I still believe this could be fixed (easily), but only if more information can be provided.
Please add complete, uncut output and command line of the failing command.