#4279 closed defect (invalid)
DTS < PCR error when using muxrate option in mpegts
Reported by: | Zach | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | mpegts |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
When trying to encode any slate video source that contains still pictures that transition with a cut. Particularly on slides of solid colors, or other easy to compress frames.
How to reproduce:
% ffmpeg -i cut_encode_test.mp4 -f mpegts -mpegts_pmt_start_pid 0x40 -mpegts_start_pid 0x45 -vf "fps=29.97,scale=704x480" -muxrate 1000k -vcodec mpeg2video -threads 0 -tune zerolatency -pix_fmt yuv420p -b:v 500k -acodec ac3 -ar 48000 -b:a 50k -me_method epzs out.ts ffmpeg-20150122-git-6c559a0-win64-static built by zeranoe
Attachments (1)
Change History (7)
by , 10 years ago
Attachment: | cut_encode_test.mp4 added |
---|
comment:1 by , 10 years ago
comment:2 by , 10 years ago
So after simplifying the command further by removing the audio, and playing with the bit rates I noticed some weird behavior. I went to using the original source file I recorded on a hyperdeck shuttle, because I was not sure if the source bit rate effected anything. That file is too large to upload here, but the mp4 I uploaded shows the same behavior at a slightly lower bit rate.
The error does not happen when I have the muxrate 50k more then three times the video bit rate for this test file. If I omit the -b:v argument, then I can go down to 1401k. This also happens with audio present at higher bit rates with more complex video. This appears to be the encoder or mux breaking down for some reason, but I am not sure what to pursue as the cause.
I will experiment further with more complex video. My goal is to encode video in the 2-3 Mbps range for use on ATSC TV, hence the requirement for a tight pcr interval that FFmpeg only does when using the muxrate command.
ffmpeg -v 9 -loglevel 99 -i "C:/Users/Zach/Development/Test Files/Capture0000.mov" -f mpegts -muxrate 1000k -vcodec mpeg2video -b:v 500k -an out.ts
and
ffmpeg -v 9 -loglevel 99 -i "C:/Users/Zach/Development/Test Files/Capture0000.mov" -f mpegts -muxrate 1401k -vcodec mpeg2video -an out.ts
comment:3 by , 10 years ago
Any of the following helpful or related? http://ffmpeg.org/pipermail/ffmpeg-devel/2009-July/070110.html http://www.waveguide.se/?article=creating-dvb-t-compatible-mpeg2-streams-using-ffmpeg http://stackoverflow.com/questions/8269969/mpeg-ts-encoding http://comments.gmane.org/gmane.comp.video.ffmpeg.user/49067 https://www.mail-archive.com/libav-user@ffmpeg.org/msg03367.html http://permalink.gmane.org/gmane.comp.video.ffmpeg.user/49097
comment:4 by , 10 years ago
I know there were some complaints in the comments here: http://www.waveguide.se/?article=creating-dvb-t-compatible-mpeg2-streams-using-ffmpeg (which may contain some other helpful info) about ffmpeg's TS muxer being broken? Same thing?
comment:5 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
No max rate and VBV buffer size is set so the bitrate can exceed the muxrate and fail.
its impossible to store a stream that exceeds the muxrate in the VBV sense significantly with said muxrate. To avoid such cases the parameters have to be set up correctly, the exact parameters depend on the target one encodes for ...
comment:6 by , 10 years ago
Keywords: | mpegts added |
---|
Here is an updated simplified command with verbose mode console output.
ffmpeg -v 9 -loglevel 99 -i cut_encode_test.mp4 -f mpegts -muxrate 1000k -vcodec mpeg2video -b:v 500k -acodec ac3 -ar 48000 -b:a 50k out.ts
ffmpeg version N-69190-g6c559a0 Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 22 2015 03:13:44 with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avis
ynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable
-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --en
able-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmo
dplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enab
le-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis -
-enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-li
bx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable
-zlib
libavutil 54. 17.100 / 54. 17.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 19.100 / 56. 19.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 8.101 / 5. 8.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
For help run: ffmpeg -h
For formats run: ffmpeg -formats | more
For codecs run: ffmpeg -codecs | more
Current directory is now: "C:\Users\Zach\Development\ffmpeg-20150122-git-6c559a0
-win64-static\bin"
The bin directory has been added to PATH
c mpeg2video -b:v 500k -acodec ac3 -ar 48000 -b:a 50k out.ts
ffmpeg version N-69190-g6c559a0 Copyright (c) 2000-2015 the FFmpeg developers
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab
le-zlib
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument
'9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level)
with argument '99'.
Reading option '-i' ... matched as input file with argument 'cut_encode_test.mp4
'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mpeg
ts'.
Reading option '-muxrate' ... matched as AVOption 'muxrate' with argument '1000k
'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('cop
y' to copy stream)) with argument 'mpeg2video'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)
) with argument '500k'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('cop
y' to copy stream)) with argument 'ac3'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)
) with argument '48000'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)
) with argument '50k'.
Reading option 'out.ts' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file cut_encode_test.mp4.
Successfully parsed a group of options.
Opening an input file: cut_encode_test.mp4.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002be8be0] Format mov,mp4,m4a,3gp,3g2,mj2 prob
ed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002be8be0] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002be8be0] Before avformat_find_stream_info()
pos: 2123942 bytes read:73458 seeks:1
[h264 @ 0000000002bf9e80] no picture
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002be8be0] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002be8be0] After avformat_find_stream_info() p
os: 1406 bytes read:106226 seeks:2 frames:3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'cut_encode_test.mp4':
yuv422p(left), 720x486 (720x496) [SAR 10:11 DAR 400:297], 1001/60000, 337 kb/s,
29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Successfully opened the file.
Parsing a group of options: output file out.ts.
Applying option f (force format) with argument mpegts.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument
Applying option b:v (video bitrate (please use -b:v)) with argument 500k.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument
Applying option ar (set audio sampling rate (in Hz)) with argument 48000.
Applying option b:a (video bitrate (please use -b:v)) with argument 50k.
Successfully parsed a group of options.
Opening an output file: out.ts.
Successfully opened the file.
detected 2 logical cores
[graph 0 input from stream 0:0 @ 0000000002bcd9a0] Setting 'video_size' to value
[graph 0 input from stream 0:0 @ 0000000002bcd9a0] Setting 'pix_fmt' to value '4
'
[graph 0 input from stream 0:0 @ 0000000002bcd9a0] Setting 'time_base' to value
'1/30000'
[graph 0 input from stream 0:0 @ 0000000002bcd9a0] Setting 'pixel_aspect' to val
ue '10/11'
[graph 0 input from stream 0:0 @ 0000000002bcd9a0] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 0:0 @ 0000000002bcd9a0] Setting 'frame_rate' to value
[graph 0 input from stream 0:0 @ 0000000002bcd9a0] w:720 h:486 pixfmt:yuv422p tb
:1/30000 fr:30000/1001 sar:10/11 sws_param:flags=2
[format @ 0000000002d28040] compat: called with args=[yuv420p|yuv422p]
[format @ 0000000002d28040] Setting 'pix_fmts' to value 'yuv420p|yuv422p'
[AVFilterGraph @ 0000000002d28ae0] query_formats: 4 queried, 3 merged, 0 already
No pixel format specified, yuv422p for MPEG-2 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[graph 1 input from stream 0:1 @ 0000000002d2d120] Setting 'time_base' to value
'1/48000'
[graph 1 input from stream 0:1 @ 0000000002d2d120] Setting 'sample_rate' to valu
e '48000'
[graph 1 input from stream 0:1 @ 0000000002d2d120] Setting 'sample_fmt' to value
[graph 1 input from stream 0:1 @ 0000000002d2d120] Setting 'channel_layout' to v
alue '0x3'
[graph 1 input from stream 0:1 @ 0000000002d2d120] tb:1/48000 samplefmt:fltp sam
plerate:48000 chlayout:0x3
[audio format for output stream 0:1 @ 0000000002d2d2a0] Setting 'sample_fmts' to
[audio format for output stream 0:1 @ 0000000002d2d2a0] Setting 'sample_rates' t
o value '48000'
[audio format for output stream 0:1 @ 0000000002d2d2a0] Setting 'channel_layouts
' to value '0x4|0x3|0x103|0x7|0x603|0x33|0x107|0x607|0x37|0xc|0xb|0x10b|0xf|0x60
b|0x3b|0x10f|0x60f|0x3f'
[AVFilterGraph @ 0000000002d2c300] query_formats: 4 queried, 9 merged, 0 already
[mpeg2video @ 0000000002bfb5a0] intra_quant_bias = 96 inter_quant_bias = 0
[mpegts @ 000000000570f0c0] muxrate 1000000, pcr every 13 pkts, sdt every 332, p
at/pmt every 66 pkts
Output #0, mpegts, to 'out.ts':
efault)
Stream mapping:
Press [q] to stop, ? for help
[h264 @ 0000000005623600] no picture
[h264 @ 0000000005624580] no picture
* 1 dup!
Cliping frame in rate conversion by 0.000999
frame= 34 fps=0.0 q=2.0 size= 131kB time=00:00:01.17 bitrate= 908.5kbits/s
Cliping frame in rate conversion by 0.000999
frame= 62 fps= 61 q=1.6 size= 252kB time=00:00:02.10 bitrate= 978.1kbits/s
Cliping frame in rate conversion by 0.000999
frame= 95 fps= 61 q=1.6 size= 440kB time=00:00:03.22 bitrate=1117.7kbits/s
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
frame= 108 fps= 50 q=2.0 size= 543kB time=00:00:03.64 bitrate=1220.5kbits/s
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
frame= 119 fps= 42 q=1.6 size= 620kB time=00:00:04.02 bitrate=1261.3kbits/s
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
frame= 131 fps= 38 q=1.6 size= 707kB time=00:00:04.41 bitrate=1312.8kbits/s
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
frame= 143 fps= 34 q=1.6 size= 797kB time=00:00:04.82 bitrate=1352.0kbits/s
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
frame= 155 fps= 31 q=1.6 size= 887kB time=00:00:05.21 bitrate=1393.8kbits/s
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
Cliping frame in rate conversion by 0.000999
[mpegts @ 000000000570f0c0] dts < pcr, TS is invalid
frame= 157 fps= 31 q=2.8 Lsize= 907kB time=00:00:05.27 bitrate=1408.3kbits/
s dup=1 drop=0
video:552kB audio:31kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 55.425217%
Input file #0 (cut_encode_test.mp4):
;
(253952 samples);
Output file #0 (out.ts):
s);
uxed (31680 bytes);
409 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000000002bf1d40] Statistics: 0 seeks, 175 writeouts
[AVIOContext @ 0000000002bf1520] Statistics: 532293 bytes read, 2 seeks
Received signal 2: terminating.