Opened 12 years ago
Last modified 12 years ago
#1487 new defect
ffmpeg's mpeg mux bug(s) never fixed...
Reported by: | downuse | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | git-master | Keywords: | mpegps |
Cc: | Michael Niedermayer | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
i'm trying to mux a mpg file use the following cmd
ffmpeg -y -i 1.m2v -i 1.mp2 -c copy -f svcd 1.mpg
it finished muxing without any errors & warnings.
of cause, the original mpg file is normal.
but the muxed mpg file is not normal, it can be played on PC with codecs but not in most DVD players.
the following bugs i found:
- audio always has a Delay relative to video such as "-67ms"
- the mux rate is too big.. i think it should divided by 8.
- i think the PCR is also buged, it's not begin with 0, the SCR base is not begin with 0, either.
it's hard to read the mpegenc.c for me,
i think developers can fix it well.
sorry for my bad eng.
Attachments (2)
Change History (15)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
ok. the output
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers built on Jun 27 2012 00:14:15 with gcc 4.7.0 configuration: --enable-gpl --enable-version3 --enable-libvo-aacenc libavutil 51. 54.100 / 51. 54.100 libavcodec 54. 23.100 / 54. 23.100 libavformat 54. 6.100 / 54. 6.100 libavdevice 54. 0.100 / 54. 0.100 libavfilter 2. 77.100 / 2. 77.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 [mpegvideo @ 003cbf00] max_analyze_duration 5000000 reached at 5005000 [mpegvideo @ 003cbf00] Estimating duration from bitrate, this may be inaccurate Input #0, mpegvideo, from '17.m2v': Duration: 00:03:34.38, bitrate: 6000 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 6 000 kb/s, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc [mp3 @ 0272e020] max_analyze_duration 5000000 reached at 5016000 [mp3 @ 0272e020] Estimating duration from bitrate, this may be inaccurate Input #1, mp3, from '17.mp2': Duration: 00:03:34.39, start: 0.000000, bitrate: 384 kb/s Stream #1:0: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s Output #0, svcd, to '1.mpg': Metadata: encoder : Lavf54.6.100 Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, 6000 kb/s, 29.97 fps, 90k tbn, 29.97 tbc Stream #0:1: Audio: mp2, 48000 Hz, stereo, 384 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #1:0 -> #0:1 (copy) Press [q] to stop, [?] for help frame= 757 fps=0.0 q=-1.0 size= 19904kB time=00:00:25.24 bitrate=6458.1kbits/ frame= 1191 fps=1162 q=-1.0 size= 31358kB time=00:00:39.73 bitrate=6464.2kbits frame= 1599 fps=1040 q=-1.0 size= 42110kB time=00:00:53.35 bitrate=6465.8kbits frame= 1981 fps=966 q=-1.0 size= 52206kB time=00:01:06.09 bitrate=6470.5kbits/ frame= 2467 fps=964 q=-1.0 size= 65002kB time=00:01:22.31 bitrate=6469.0kbits/ frame= 2719 fps=889 q=-1.0 size= 71536kB time=00:01:30.69 bitrate=6461.4kbits/ frame= 3445 fps=968 q=-1.0 size= 90688kB time=00:01:54.91 bitrate=6465.1kbits/ frame= 4013 fps=989 q=-1.0 size= 105620kB time=00:02:13.87 bitrate=6463.2kbits/ frame= 4401 fps=937 q=-1.0 size= 115830kB time=00:02:26.83 bitrate=6462.3kbits/ frame= 4471 fps=846 q=-1.0 size= 117732kB time=00:02:29.18 bitrate=6465.0kbits/ frame= 4889 fps=843 q=-1.0 size= 128698kB time=00:02:43.12 bitrate=6463.0kbits/ frame= 5543 fps=878 q=-1.0 size= 145940kB time=00:03:04.94 bitrate=6464.3kbits/ frame= 5827 fps=829 q=-1.0 size= 153400kB time=00:03:14.42 bitrate=6463.5kbits/ frame= 6271 fps=832 q=-1.0 size= 165034kB time=00:03:29.23 bitrate=6461.5kbits/ frame= 6425 fps=845 q=-1.0 Lsize= 169136kB time=00:03:34.38 bitrate=6463.1kbits /s video:157017kB audio:10050kB global headers:0kB muxing overhead 1.238463%
comment:3 by , 12 years ago
Component: | undetermined → avformat |
---|---|
Keywords: | mpeg added |
follow-up: 7 comment:4 by , 12 years ago
Replying to downuse:
i'm trying to mux a mpg file use the following cmd
ffmpeg -y -i 1.m2v -i 1.mp2 -c copy -f svcd 1.mpg
it finished muxing without any errors & warnings.
of cause, the original mpg file is normal.
but the muxed mpg file is not normal, it can be played on PC with codecs but not in most DVD players.
which DVD player exactly ?
what happens if its played on such DVD player ?
is this a regression (that is did it work with older ffmpeg) ?
the following bugs i found:
- audio always has a Delay relative to video such as "-67ms"
what do you mean by delay ? delay of audio vs video content, of timestamps, of ?
if its about timestamps please quote the timestamps that are wrong and please explain why you think they are wrong. A reference to a specific section of a specification would be best.
- the mux rate is too big.. i think it should divided by 8.
what muxrate did you specify, what was stored, what did you expect? what tool did you use to see its wrong.
- i think the PCR is also buged, it's not begin with 0, the SCR base is not begin with 0, either.
PCR is MPEG-TS your sample is SVCD (PS) so this comment makes no sense to me
and please use git master
follow-up: 6 comment:5 by , 12 years ago
Cc: | added |
---|
by , 12 years ago
Attachment: | MPEGPSUtils.7z added |
---|
comment:6 by , 12 years ago
Replying to michael:
MPEG-PS files muxed with ffmpeg just can't play(turned black) or can't playback or show wrong play time in most karaoke's mpeg-play-system.
So i tried to find out the reason in many ways, finally i found these:
i use Mediainfo to see the mpg info.
the playable one's audio info is (it is muxed with mplex.exe(a stuff of mjpegtools-2.0.0))
Audio ID : 192 (0xC0) Format : MPEG Audio Format version : Version 1 Format profile : Layer 2 Duration : 3s 0ms Bit rate mode : Constant Bit rate : 96.0 Kbps Channel(s) : 2 channels Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 35.2 KiB (9%)
and the non-playable one
it has a Delay relative to video : -67ms
Audio ID : 192 (0xC0) Format : MPEG Audio Format version : Version 1 Format profile : Layer 2 Duration : 3s 0ms Bit rate mode : Constant Bit rate : 96.0 Kbps Channel(s) : 2 channels Sampling rate : 48.0 KHz Compression mode : Lossy Delay relative to video : -67ms Stream size : 35.2 KiB (9%)
i use MPEG PS Utils to see the PS Format Info, this file is added to the attachment.
it shows the differences between the two mpg files in detail.
the non-playable mpg file's system_clock_reference_base is not begin with Zero and its mux-rate seems to large.
comment:7 by , 12 years ago
Replying to michael:
which DVD player exactly ?
what happens if its played on such DVD player ?
is this a regression (that is did it work with older ffmpeg) ?
it is black screen but has sound.
i learned a lot and found that it is because the muxrate is too large.
what do you mean by delay ? delay of audio vs video content, of timestamps, of ?
if its about timestamps please quote the timestamps that are wrong and please explain why you think they are wrong. A reference to a specific section of a specification would be best.
the scr is always begin with 28616 either than 0,i mean the first timestamp is 00:00:00.50 not 00:00:00.00
what muxrate did you specify, what was stored, what did you expect? what tool did you use to see its wrong.
i didn't use "-muxrate" and the default muxrate estimating is not correct.
when use "-muxrate", it is correct.
- i think the PCR is also buged, it's not begin with 0, the SCR base is not begin with 0, either.
not PCR, i mean SCR system clock reference base
comment:8 by , 12 years ago
Version: | unspecified → git-master |
---|
comment:9 by , 12 years ago
Keywords: | mpegps added; mpeg removed |
---|
follow-up: 11 comment:10 by , 12 years ago
Is this still reproducible for current git head? If it is, please provide your command line together with complete, uncut console output for git head.
follow-up: 12 comment:11 by , 12 years ago
Replying to cehoyos:
Is this still reproducible for current git head? If it is, please provide your command line together with complete, uncut console output for git head.
default muxrate estimating seems fixed.
but system_clock_reference_base is still not begin with zero.
and some buffer underflow problems.
ffmpeg started on 2012-12-21 at 01:22:34
Report written to "ffmpeg-20121221-012234.log"
Command line:
ffmpeg -loglevel debug -report -y -i 480.m2v -i 480.mp2 -map 0 -c copy -map 1 -c copy -f svcd 480.mpg
ffmpeg version 1.0.git-c7a1239 Copyright (c) 2000-2012 the FFmpeg developers
built on Dec 21 2012 01:09:25 with gcc 4.6.2 (GCC)
configuration: --enable-gpl --enable-version3 --enable-libvo-aacenc --disable-hwaccels --disable-devices --disable-bzlib --disable-zlib
libavutil 52. 12.100 / 52. 12.100
libavcodec 54. 81.100 / 54. 81.100
libavformat 54. 49.102 / 54. 49.102
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 29.100 / 3. 29.100
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set libav* logging level) with argument 'debug'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-i' ... matched as input file with argument '480.m2v'.
Reading option '-i' ... matched as input file with argument '480.mp2'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '1'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'svcd'.
Reading option '480.mpg' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set libav* logging level) with argument debug.
Applying option report (generate a report) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file 480.m2v.
Successfully parsed a group of options.
Opening an input file: 480.m2v.
[mpegvideo @ 017cf6a0] Format mpegvideo probed with size=8192 and score=51
[mpegvideo @ 017cf6a0] File position before avformat_find_stream_info() is 0
[mpegvideo @ 017cf6a0] max_analyze_duration 5000000 reached at 5005000
[mpegvideo @ 017cf6a0] Estimating duration from bitrate, this may be inaccurate
[mpegvideo @ 017cf6a0] File position after avformat_find_stream_info() is 2267136
Input #0, mpegvideo, from '480.m2v':
Duration: N/A, bitrate: N/A
Stream #0:0, 152, 1/1200000: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 1001/60000, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc
Successfully openened the file.
Parsing a group of options: input file 480.mp2.
Successfully parsed a group of options.
Opening an input file: 480.mp2.
[mp3 @ 0291e9e0] Format mp3 probed with size=4096 and score=51
[mp3 @ 0291e9e0] File position before avformat_find_stream_info() is 0
[mp3 @ 0291e9e0] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0291e9e0] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 0291e9e0] File position after avformat_find_stream_info() is 143360
Input #1, mp3, from '480.mp2':
Duration: 00:04:09.00, start: 0.000000, bitrate: 223 kb/s
Stream #1:0, 194, 1/14112000: Audio: mp2, 44100 Hz, stereo, s16p, 224 kb/s
Successfully openened the file.
Parsing a group of options: output file 480.mpg.
Applying option map (set input stream mapping) with argument 0.
Applying option c (codec name) with argument copy.
Applying option map (set input stream mapping) with argument 1.
Applying option c (codec name) with argument copy.
Applying option f (force format) with argument svcd.
Successfully parsed a group of options.
Opening an output file: 480.mpg.
Successfully openened the file.
Output #0, svcd, to '480.mpg':
Metadata:
encoder : Lavf54.49.102
Stream #0:0, 0, 1/90000: Video: mpeg2video, yuv420p, 720x480 [SAR 32:27 DAR 16:9], 1001/30000, q=2-31, 29.97 fps, 90k tbn, 29.97 tbc
Stream #0:1, 0, 1/90000: Audio: mp2, 44100 Hz, stereo, 224 kb/s
Stream mapping:
Press [q] to stop, ? for help
frame= 2395 fps=0.0 q=-1.0 size= 36852kB time=00:01:19.91 bitrate=3777.7kbits/s
buffer underflow i=0 bufi=106197 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=108221 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=110245 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=112269 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=114293 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=116317 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=118341 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=120365 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=122389 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=124413 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=126437 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=128461 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=130485 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=132509 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=134533 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=134533 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=136557 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=138581 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=140605 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=142629 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=144653 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=146677 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=148701 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=150725 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=152749 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=154773 size=156633
[svcd @ 028db9e0] buffer underflow i=0 bufi=164 size=10030
[svcd @ 028db9e0] buffer underflow i=0 bufi=2188 size=10030
[svcd @ 028db9e0] buffer underflow i=0 bufi=4212 size=10030
[svcd @ 028db9e0] buffer underflow i=0 bufi=6218 size=10030
[svcd @ 028db9e0] buffer underflow i=0 bufi=8242 size=10030
[svcd @ 028db9e0] buffer underflow i=0 bufi=231 size=7186
[svcd @ 028db9e0] buffer underflow i=0 bufi=2255 size=7186
[svcd @ 028db9e0] buffer underflow i=0 bufi=4279 size=7186
[svcd @ 028db9e0] buffer underflow i=0 bufi=6303 size=7186
[svcd @ 028db9e0] buffer underflow i=0 bufi=1136 size=7399
[svcd @ 028db9e0] buffer underflow i=0 bufi=3160 size=7399
[svcd @ 028db9e0] buffer underflow i=0 bufi=5184 size=7399
[svcd @ 028db9e0] buffer underflow i=0 bufi=7208 size=7399
[svcd @ 028db9e0] buffer underflow i=0 bufi=1833 size=6403
[svcd @ 028db9e0] buffer underflow i=0 bufi=3857 size=6403
[svcd @ 028db9e0] buffer underflow i=0 bufi=5881 size=6403
[svcd @ 028db9e0] buffer underflow i=0 bufi=1497 size=8155
[svcd @ 028db9e0] buffer underflow i=0 bufi=3521 size=8155
[svcd @ 028db9e0] buffer underflow i=0 bufi=5545 size=8155
[svcd @ 028db9e0] buffer underflow i=0 bufi=7569 size=8155
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=0 bufi=5481 size=8330
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=0 bufi=7505 size=8330
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
frame= 3424 fps=3221 q=-1.0 size= 52772kB time=00:01:54.24 bitrate=3784.0kbits/s
buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=420 size=731
[svcd @ 028db9e0] buffer underflow i=1 bufi=245 size=731
frame= 4632 fps=2963 q=-1.0 size= 71250kB time=00:02:34.55 bitrate=3776.5kbits/s
frame= 5297 fps=2560 q=-1.0 size= 81430kB time=00:02:56.74 bitrate=3774.2kbits/s
frame= 5751 fps=2235 q=-1.0 size= 88444kB time=00:03:11.89 bitrate=3775.7kbits/s
frame= 6109 fps=1978 q=-1.0 size= 93962kB time=00:03:23.83 bitrate=3776.2kbits/s
No more output streams to write to, finishing.
frame= 7459 fps=2266 q=-1.0 Lsize= 114608kB time=00:04:08.99 bitrate=3770.6kbits/s
video:106386kB audio:6809kB subtitle:0 global headers:0kB muxing overhead 1.248262%
[AVIOContext @ 017cfc40] Statistics: 108939733 bytes read, 0 seeks
[AVIOContext @ 0276f680] Statistics: 7004873 bytes read, 2 seeks
follow-up: 13 comment:12 by , 12 years ago
Replying to downuse:
default muxrate estimating seems fixed.
but system_clock_reference_base is still not begin with zero.
I believe this was fixed, please test again.
comment:13 by , 12 years ago
Replying to cehoyos:
I believe this was fixed, please test again.
---
Yes, scr is now begin with 0, but it's not continuous,
such as
00:00:00.00 (0)
00:00:00.00 (225)
00:00:00.01 (450)
00:00:00.01 (675)
00:00:00.01 (900)
00:00:00.01 (1125)
00:00:00.01 (1350)
00:00:00.50 (12233) -> it should be like 00:00:00.02
00:00:00.50
00:00:00.51
i think this line in avformat/mpegenc.c
line:985 scr= FFMAX(best_dts+1, scr);
cause the scr jmp.
and if it is possible, please do something with scr_ext, it's now 0 anywhere.
video stream should have both PTS and DTS in I and P frame, B frame only have PTS because its PTS=DTS
PTS should have some time (like 00:00:00.04) later than DTS
the first PTS of each stream should be same,
and first PTS of video stream is AV_NOPTS_VALUE in current git head.
by the way, what do rel_space,premux_packet and predecode_packet mean...
i don't understand how to result "best_i".
To make this a valid ticket, please provide complete, uncut console output together with the command line you used.