Opened 8 years ago

Closed 3 years ago

Last modified 3 years ago

#5239 closed enhancement (fixed)

support options for MPEGTS muxer when using RTP_MPEGTS

Reported by: mattdicken Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: rtp_mpegts
Cc: silvo@gmx.net Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

I'm trying to produce a MPEG TS over RTP with a constant muxrate. I am able produce a MPEG TS with constant muxrate over UDP using the "mpegts" output format (as shown in the first pasted console output below), but after changing the command to use "rtp_mpegts" and a RTP:// address, the output bit rate simply follows the A/V rate. I.E the -muxrate option is ignored and the null packets are not inserted. Having compared the outputs using a TS analyzer, I've also noticed that the -streamid and -metadata options are also ignored because the PIDs and service names are different. Perhaps all options are being ignored in that case?

COMMAND 1: MPEGTS over UDP

c:\ffmpeg-2-8-3\bin\ffmpeg -loop 1 -re -i HOLPGKO01/bars/NFLbars%03d.jpg -f lavfi -i "amovie=holpgko01/tone/tone.wav:loop=0, asetpts=N/(FRAME_RATE*TB)" -c:v libx264 -profile:v high -pix_fmt yuvj420p -g 5 -b:v 1M -minrate 1M -maxrate 1M -bufsize 512k -b:a 384k -map 0:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -f mpegts -streamid 0:31 -streamid 1:32 -streamid 2:33 -streamid 3:34 -streamid 4:35 -muxrate 8M -mpegts_pmt_start_pid 0x001E -metadata service_provider="Provider" -metadata service_name="Service 1" udp://239.118.0.20:11820?pkt_size=1316

ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers

built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av

isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc

--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl

e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib

libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100

[mjpeg @ 0000000000328100] Changeing bps to 8
Input #0, image2, from 'HOLPGKO01/bars/NFLbars%03d.jpg':

Duration: 00:00:12.60, start: 0.000000, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080

[SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
[Parsed_amovie_0 @ 00000000056cf0a0] Channel layout is not set in output stream
0, guessed channel layout is 'stereo'
Input #1, lavfi, from 'amovie=holpgko01/tone/tone.wav:loop=0, asetpts=N/(FRAME
_RATE*TB)':

Duration: N/A, bitrate: 1536 kb/s

Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s

[libx264 @ 0000000000335ba0] using SAR=1/1
[libx264 @ 0000000000335ba0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000000335ba0] profile High, level 4.0
Output #0, mpegts, to 'udp://239.118.0.20:11820?pkt_size=1316':

Metadata:

service_provider: Provider
service_name : Service 1
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:

9], q=-1--1, 1000 kb/s, 25 fps, 90k tbn, 25 tbc

Metadata:

encoder : Lavc56.60.100 libx264

Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
Metadata:

encoder : Lavc56.60.100 mp2

Stream #0:2: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
Metadata:

encoder : Lavc56.60.100 mp2

Stream #0:3: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
Metadata:

encoder : Lavc56.60.100 mp2

Stream #0:4: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
Metadata:

encoder : Lavc56.60.100 mp2

Stream mapping:

Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp2 (native))
Stream #1:0 -> #0:2 (pcm_s16le (native) -> mp2 (native))
Stream #1:0 -> #0:3 (pcm_s16le (native) -> mp2 (native))
Stream #1:0 -> #0:4 (pcm_s16le (native) -> mp2 (native))

Press [q] to stop, ? for help
[image2 @ 00000000003251e0] Thread message queue blocking; consider raising the
thread_queue_size option (current value: 8)
frame= 37 fps= 36 q=33.0 size= 509kB time=00:00:00.52 bitrate=8011.7kbits/
frame= 49 fps= 32 q=33.0 size= 1017kB time=00:00:01.00 bitrate=8330.7kbits/
frame= 62 fps= 30 q=33.0 size= 1485kB time=00:00:01.52 bitrate=8004.8kbits/
frame= 74 fps= 29 q=33.0 size= 1994kB time=00:00:02.00 bitrate=8142.4kbits/
frame= 87 fps= 29 q=33.0 size= 2501kB time=00:00:02.52 bitrate=8128.8kbits/
frame= 100 fps= 28 q=32.0 size= 2973kB time=00:00:03.04 bitrate=8012.3kbits/
frame= 112 fps= 28 q=32.0 size= 3478kB time=00:00:03.52 bitrate=8093.4kbits/
frame= 125 fps= 27 q=33.0 size= 3950kB time=00:00:04.04 bitrate=8008.8kbits/
frame= 137 fps= 27 q=33.0 size= 4454kB time=00:00:04.52 bitrate=8061.4kbits/
frame= 150 fps= 27 q=32.0 size= 4962kB time=00:00:05.04 bitrate=8064.6kbits/
frame= 163 fps= 27 q=30.0 size= 5430kB time=00:00:05.56 bitrate=8001.0kbits/
frame= 175 fps= 27 q=31.0 size= 5938kB time=00:00:06.04 bitrate=8053.9kbits/
frame= 188 fps= 27 q=30.0 size= 6407kB time=00:00:06.56 bitrate=8001.0kbits/
frame= 200 fps= 26 q=31.0 size= 6915kB time=00:00:07.04 bitrate=8039.4kbits/
frame= 213 fps= 26 q=33.0 size= 7439kB time=00:00:07.56 bitrate=8061.3kbits/
frame= 226 fps= 26 q=32.0 size= 7894kB time=00:00:08.08 bitrate=8003.2kbits/
frame= 238 fps= 26 q=32.0 size= 8415kB time=00:00:08.56 bitrate=8053.4kbits/
frame= 251 fps= 26 q=32.0 size= 8870kB time=00:00:09.08 bitrate=8002.8kbits/
frame= 263 fps= 26 q=30.0 size= 9390kB time=00:00:09.56 bitrate=8041.7kbits/
frame= 276 fps= 26 q=33.0 size= 9884kB time=00:00:10.08 bitrate=8032.4kbits/
frame= 288 fps= 26 q=31.0 size= 10368kB time=00:00:10.56 bitrate=8042.7kbits/
frame= 301 fps= 26 q=33.0 size= 10860kB time=00:00:11.08 bitrate=8029.3kbits/
frame= 314 fps= 26 q=32.0 size= 11345kB time=00:00:11.60 bitrate=8012.0kbits/
frame= 326 fps= 26 q=32.0 size= 11836kB time=00:00:12.08 bitrate=8022.9kbits/
frame= 339 fps= 26 q=31.0 size= 12322kB time=00:00:12.60 bitrate=8011.2kbits/
frame= 351 fps= 26 q=31.0 size= 12813kB time=00:00:13.08 bitrate=8024.9kbits/
frame= 364 fps= 26 q=31.0 size= 13300kB time=00:00:13.60 bitrate=8011.5kbits/
frame= 376 fps= 26 q=32.0 size= 13790kB time=00:00:14.08 bitrate=8023.2kbits/
frame= 389 fps= 26 q=32.0 size= 14299kB time=00:00:14.60 bitrate=8019.7kbits/
frame= 402 fps= 26 q=32.0 size= 14769kB time=00:00:15.12 bitrate=8001.6kbits/
frame= 408 fps= 25 q=-1.0 Lsize= 15900kB time=00:00:16.24 bitrate=8020.5kbits
/s
video:1574kB audio:2880kB subtitle:0kB other streams:0kB global headers:0kB muxi
ng overhead: 256.951935%
[libx264 @ 0000000000335ba0] frame I:82 Avg QP:20.83 size: 16417
[libx264 @ 0000000000335ba0] frame P:102 Avg QP:25.24 size: 1420
[libx264 @ 0000000000335ba0] frame B:224 Avg QP:38.17 size: 541
[libx264 @ 0000000000335ba0] consecutive B-frames: 25.2% 2.5% 6.6% 65.7%
[libx264 @ 0000000000335ba0] mb I I16..4: 62.6% 29.7% 7.7%
[libx264 @ 0000000000335ba0] mb P I16..4: 1.5% 0.7% 0.0% P16..4: 3.6% 0.6
% 0.2% 0.0% 0.0% skip:93.4%
[libx264 @ 0000000000335ba0] mb B I16..4: 0.1% 0.1% 0.0% B16..8: 3.9% 0.3
% 0.0% direct: 0.0% skip:95.6% L0:39.1% L1:60.7% BI: 0.2%
[libx264 @ 0000000000335ba0] 8x8 transform intra:29.7% inter:53.3%
[libx264 @ 0000000000335ba0] coded y,uvDC,uvAC intra: 6.4% 2.1% 1.1% inter: 0.2%

0.1% 0.1%

[libx264 @ 0000000000335ba0] i16 v,h,dc,p: 82% 15% 2% 0%
[libx264 @ 0000000000335ba0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 19% 42% 1% 0%

0% 0% 0% 1%

[libx264 @ 0000000000335ba0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 26% 11% 8% 3%

3% 3% 4% 3%

[libx264 @ 0000000000335ba0] i8c dc,h,v,p: 83% 11% 6% 0%
[libx264 @ 0000000000335ba0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000000335ba0] ref P L0: 94.9% 2.7% 1.7% 0.6%
[libx264 @ 0000000000335ba0] ref B L0: 89.7% 10.3%
[libx264 @ 0000000000335ba0] ref B L1: 91.2% 8.8%
[libx264 @ 0000000000335ba0] kb/s:790.27
Exiting normally, received signal 2.

COMMAND 2: MPEGTS over RTP

c:\ffmpeg-2-8-3\bin\ffmpeg -loop 1 -re -i HOLPGKO01/bars/NFLbars%03d.jpg -f lavfi -i "amovie=holpgko01/tone/tone.wav:loop=0, asetpts=N/(FRAME_RATE*TB)" -c:v libx264 -profile:v high -pix_fmt yuvj420p -g 5 -b:v 1M -minrate 1M -maxrate 1M -bufsize 512k -b:a 384k -map 0:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -f rtp_mpegts -streamid 0:31 -streamid 1:32 -streamid 2:33 -streamid 3:34 -streamid 4:35 -muxrate 8M -mpegts_pmt_start_pid 0x001E -metadata service_provider="Provider" -metadata service_name="Service 1" rtp://239.118.0.20:11820?pkt_size=1316

ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers

built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av

isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc

--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl

e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib

libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100

[mjpeg @ 0000000000328100] Changeing bps to 8
Input #0, image2, from 'HOLPGKO01/bars/NFLbars%03d.jpg':

Duration: 00:00:12.60, start: 0.000000, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080

[SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
[Parsed_amovie_0 @ 00000000057bf0a0] Channel layout is not set in output stream
0, guessed channel layout is 'stereo'
Input #1, lavfi, from 'amovie=holpgko01/tone/tone.wav:loop=0, asetpts=N/(FRAME
_RATE*TB)':

Duration: N/A, bitrate: 1536 kb/s

Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s

[libx264 @ 0000000000335ba0] using SAR=1/1
[libx264 @ 0000000000335ba0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000000335ba0] profile High, level 4.0
Output #0, rtp_mpegts, to 'rtp://239.118.0.20:11820?pkt_size=1316':

Metadata:

service_provider: Provider
service_name : Service 1
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:

9], q=-1--1, 1000 kb/s, 25 fps, 90k tbn, 25 tbc

Metadata:

encoder : Lavc56.60.100 libx264

Stream #0:1: Audio: aac (libvo_aacenc), 48000 Hz, stereo, s16, 384 kb/s
Metadata:

encoder : Lavc56.60.100 libvo_aacenc

Stream #0:2: Audio: aac (libvo_aacenc), 48000 Hz, stereo, s16, 384 kb/s
Metadata:

encoder : Lavc56.60.100 libvo_aacenc

Stream #0:3: Audio: aac (libvo_aacenc), 48000 Hz, stereo, s16, 384 kb/s
Metadata:

encoder : Lavc56.60.100 libvo_aacenc

Stream #0:4: Audio: aac (libvo_aacenc), 48000 Hz, stereo, s16, 384 kb/s
Metadata:

encoder : Lavc56.60.100 libvo_aacenc

Stream mapping:

Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (libvo_aacenc))
Stream #1:0 -> #0:2 (pcm_s16le (native) -> aac (libvo_aacenc))
Stream #1:0 -> #0:3 (pcm_s16le (native) -> aac (libvo_aacenc))
Stream #1:0 -> #0:4 (pcm_s16le (native) -> aac (libvo_aacenc))

Press [q] to stop, ? for help
[image2 @ 00000000003251e0] Thread message queue blocking; consider raising the
thread_queue_size option (current value: 8)
frame= 36 fps= 35 q=33.0 size= 75kB time=00:00:00.48 bitrate=1273.5kbits/
frame= 48 fps= 31 q=31.0 size= 169kB time=00:00:00.96 bitrate=1444.2kbits/
frame= 61 fps= 30 q=33.0 size= 252kB time=00:00:01.48 bitrate=1392.8kbits/
frame= 74 fps= 29 q=33.0 size= 351kB time=00:00:02.00 bitrate=1436.5kbits/
frame= 86 fps= 28 q=33.0 size= 435kB time=00:00:02.48 bitrate=1438.0kbits/
frame= 99 fps= 28 q=33.0 size= 532kB time=00:00:03.00 bitrate=1453.2kbits/
frame= 111 fps= 27 q=32.0 size= 615kB time=00:00:03.48 bitrate=1446.7kbits/
frame= 124 fps= 27 q=33.0 size= 716kB time=00:00:04.00 bitrate=1466.1kbits/
frame= 137 fps= 27 q=33.0 size= 797kB time=00:00:04.52 bitrate=1444.7kbits/
frame= 149 fps= 27 q=32.0 size= 896kB time=00:00:05.00 bitrate=1468.0kbits/
frame= 162 fps= 27 q=32.0 size= 974kB time=00:00:05.52 bitrate=1445.7kbits/
frame= 174 fps= 26 q=31.0 size= 1070kB time=00:00:06.00 bitrate=1460.8kbits/
frame= 187 fps= 26 q=31.0 size= 1151kB time=00:00:06.52 bitrate=1446.4kbits/
frame= 200 fps= 26 q=31.0 size= 1242kB time=00:00:07.04 bitrate=1445.8kbits/
frame= 212 fps= 26 q=32.0 size= 1334kB time=00:00:07.52 bitrate=1453.0kbits/
frame= 225 fps= 26 q=32.0 size= 1422kB time=00:00:08.04 bitrate=1448.6kbits/
frame= 237 fps= 26 q=32.0 size= 1503kB time=00:00:08.52 bitrate=1444.9kbits/
frame= 250 fps= 26 q=32.0 size= 1603kB time=00:00:09.04 bitrate=1452.8kbits/
frame= 263 fps= 26 q=31.0 size= 1689kB time=00:00:09.56 bitrate=1447.2kbits/
frame= 275 fps= 26 q=33.0 size= 1787kB time=00:00:10.04 bitrate=1458.0kbits/
frame= 288 fps= 26 q=31.0 size= 1868kB time=00:00:10.56 bitrate=1449.2kbits/
frame= 300 fps= 26 q=33.0 size= 1967kB time=00:00:11.04 bitrate=1459.8kbits/
frame= 313 fps= 26 q=30.0 size= 2047kB time=00:00:11.56 bitrate=1450.9kbits/
frame= 325 fps= 26 q=32.0 size= 2142kB time=00:00:12.04 bitrate=1457.3kbits/
frame= 338 fps= 26 q=30.0 size= 2240kB time=00:00:12.56 bitrate=1461.0kbits/
frame= 350 fps= 26 q=31.0 size= 2321kB time=00:00:13.04 bitrate=1458.3kbits/
frame= 363 fps= 26 q=30.0 size= 2420kB time=00:00:13.56 bitrate=1462.2kbits/
frame= 376 fps= 26 q=32.0 size= 2503kB time=00:00:14.08 bitrate=1456.1kbits/
frame= 388 fps= 26 q=30.0 size= 2584kB time=00:00:14.56 bitrate=1453.9kbits/
frame= 401 fps= 26 q=32.0 size= 2686kB time=00:00:15.08 bitrate=1459.4kbits/
frame= 413 fps= 26 q=31.0 size= 2784kB time=00:00:15.56 bitrate=1465.8kbits/
frame= 415 fps= 25 q=-1.0 Lsize= 2889kB time=00:00:16.52 bitrate=1432.6kbits
/s
video:1595kB audio:982kB subtitle:0kB other streams:0kB global headers:0kB muxin
g overhead: 12.116439%
[libx264 @ 0000000000335ba0] frame I:83 Avg QP:20.79 size: 16442
[libx264 @ 0000000000335ba0] frame P:105 Avg QP:25.40 size: 1400
[libx264 @ 0000000000335ba0] frame B:227 Avg QP:38.45 size: 537
[libx264 @ 0000000000335ba0] consecutive B-frames: 25.3% 2.9% 7.2% 64.6%
[libx264 @ 0000000000335ba0] mb I I16..4: 63.3% 29.0% 7.7%
[libx264 @ 0000000000335ba0] mb P I16..4: 1.5% 0.6% 0.0% P16..4: 3.6% 0.5
% 0.2% 0.0% 0.0% skip:93.5%
[libx264 @ 0000000000335ba0] mb B I16..4: 0.1% 0.0% 0.0% B16..8: 3.9% 0.2
% 0.0% direct: 0.0% skip:95.7% L0:39.0% L1:60.8% BI: 0.2%
[libx264 @ 0000000000335ba0] 8x8 transform intra:29.1% inter:51.0%
[libx264 @ 0000000000335ba0] coded y,uvDC,uvAC intra: 6.4% 2.0% 1.1% inter: 0.2%

0.1% 0.1%

[libx264 @ 0000000000335ba0] i16 v,h,dc,p: 82% 15% 2% 0%
[libx264 @ 0000000000335ba0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 18% 44% 1% 0%

0% 0% 0% 1%

[libx264 @ 0000000000335ba0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 26% 11% 8% 3%

3% 3% 4% 3%

[libx264 @ 0000000000335ba0] i8c dc,h,v,p: 83% 11% 5% 0%
[libx264 @ 0000000000335ba0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000000335ba0] ref P L0: 95.1% 2.6% 1.7% 0.6%
[libx264 @ 0000000000335ba0] ref B L0: 89.4% 10.6%
[libx264 @ 0000000000335ba0] ref B L1: 91.4% 8.6%
[libx264 @ 0000000000335ba0] kb/s:787.29
Exiting normally, received signal 2.

Change History (8)

comment:1 by Carl Eugen Hoyos, 8 years ago

Component: ffmpegavformat

Please test current FFmpeg git head.

comment:2 by mattdicken, 8 years ago

The same behaviour was observed using today's build. Although I notice that the output shows < 25 fps, so somehow this build isn't performing the same as the older version...

c:\ffmpeg-20160216-git-2e8ad2d-win64-static\bin\ffmpeg -loop 1 -re -i HOLPGKO01/bars/NFLbars%03d.jpg -f lavfi -i "amovie=holpgko01/tone/tone.wav:loop=0, asetpts=N/(FRAME_RATE*TB)" -c:v libx264 -profile:v high -pix_fmt yuvj420p -g 5 -b:v 1M -minrate 1M -maxrate 1M -bufsize 512k -b:a 384k -map 0:0 -map 1:0 -map 1:0 -map 1:0 -map 1:0 -f rtp_mpegts -streamid 0:31 -streamid 1:32 -streamid 2:33 -streamid 3:34 -streamid 4:35 -muxrate 8M -mpegts_pmt_start_pid 0x001E -metadata service_provider="Provider" -metadata service_name="Service 1" rtp://239.118.0.20:11820?pkt_size=1316

ffmpeg version N-78559-g2e8ad2d Copyright (c) 2000-2016 the FFmpeg developers

built with gcc 5.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av

isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --
enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-lib
x265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-d
ecklink --enable-zlib

libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.103 / 57. 24.103
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 32.100 / 6. 32.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100

[mjpeg @ 00000000005682e0] Changing bps to 8
Input #0, image2, from 'HOLPGKO01/bars/NFLbars%03d.jpg':

Duration: 00:00:12.60, start: 0.000000, bitrate: N/A

Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080

[SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
[Parsed_amovie_0 @ 00000000028f0f20] Channel layout is not set in output stream
0, guessed channel layout is 'stereo'
Input #1, lavfi, from 'amovie=holpgko01/tone/tone.wav:loop=0, asetpts=N/(FRAME
_RATE*TB)':

Duration: N/A, bitrate: 1536 kb/s

Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s

[libx264 @ 00000000005764c0] using SAR=1/1
[libx264 @ 00000000005764c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 00000000005764c0] profile High, level 4.0
Output #0, rtp_mpegts, to 'rtp://239.118.0.20:11820?pkt_size=1316':

Metadata:

service_provider: Provider
service_name : Service 1
encoder : Lavf57.25.100
Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:

9], q=-1--1, 1000 kb/s, 25 fps, 90k tbn, 25 tbc

Metadata:

encoder : Lavc57.24.103 libx264

Side data:

cpb: bitrate max/min/avg: 1000000/0/1000000 buffer size: 512000 vbv_delay:

-1

Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 384 kb/s
Metadata:

encoder : Lavc57.24.103 aac

Stream #0:2: Audio: aac (LC), 48000 Hz, stereo, fltp, 384 kb/s
Metadata:

encoder : Lavc57.24.103 aac

Stream #0:3: Audio: aac (LC), 48000 Hz, stereo, fltp, 384 kb/s
Metadata:

encoder : Lavc57.24.103 aac

Stream #0:4: Audio: aac (LC), 48000 Hz, stereo, fltp, 384 kb/s
Metadata:

encoder : Lavc57.24.103 aac

Stream mapping:

Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Stream #1:0 -> #0:2 (pcm_s16le (native) -> aac (native))
Stream #1:0 -> #0:3 (pcm_s16le (native) -> aac (native))
Stream #1:0 -> #0:4 (pcm_s16le (native) -> aac (native))

Press [q] to stop, ? for help
[image2 @ 00000000005653a0] Thread message queue blocking; consider raising the
thread_queue_size option (current value: 8)
frame= 30 fps=0.0 q=34.0 size= 66kB time=00:00:00.24 bitrate=2242.9kbits/
frame= 40 fps= 39 q=33.0 size= 149kB time=00:00:00.64 bitrate=1909.8kbits/
frame= 50 fps= 32 q=33.0 size= 242kB time=00:00:01.04 bitrate=1903.1kbits/
frame= 59 fps= 29 q=33.0 size= 340kB time=00:00:01.40 bitrate=1987.0kbits/
frame= 68 fps= 26 q=31.0 size= 433kB time=00:00:01.76 bitrate=2015.9kbits/
frame= 78 fps= 25 q=31.0 size= 521kB time=00:00:02.16 bitrate=1976.1kbits/
frame= 87 fps= 24 q=33.0 size= 613kB time=00:00:02.52 bitrate=1994.2kbits/
frame= 96 fps= 23 q=33.0 size= 716kB time=00:00:02.88 bitrate=2036.2kbits/
frame= 106 fps= 23 q=33.0 size= 808kB time=00:00:03.28 bitrate=2018.7kbits/
frame= 116 fps= 22 q=33.0 size= 902kB time=00:00:03.68 bitrate=2007.5kbits/
frame= 125 fps= 22 q=33.0 size= 1002kB time=00:00:04.04 bitrate=2031.8kbits/
frame= 134 fps= 22 q=33.0 size= 1092kB time=00:00:04.40 bitrate=2033.4kbits/
frame= 144 fps= 21 q=33.0 size= 1195kB time=00:00:04.80 bitrate=2038.8kbits/
frame= 153 fps= 21 q=30.0 size= 1284kB time=00:00:05.16 bitrate=2037.9kbits/
frame= 163 fps= 21 q=30.0 size= 1357kB time=00:00:05.56 bitrate=1999.6kbits/
frame= 172 fps= 21 q=31.0 size= 1455kB time=00:00:05.92 bitrate=2013.6kbits/
frame= 181 fps= 21 q=31.0 size= 1543kB time=00:00:06.28 bitrate=2012.9kbits/
frame= 190 fps= 21 q=31.0 size= 1648kB time=00:00:06.64 bitrate=2032.8kbits/
frame= 199 fps= 20 q=31.0 size= 1739kB time=00:00:07.00 bitrate=2035.1kbits/
frame= 209 fps= 20 q=32.0 size= 1827kB time=00:00:07.40 bitrate=2022.5kbits/
frame= 218 fps= 20 q=31.0 size= 1932kB time=00:00:07.76 bitrate=2039.2kbits/
frame= 227 fps= 20 q=32.0 size= 2004kB time=00:00:08.12 bitrate=2021.8kbits/
frame= 237 fps= 20 q=32.0 size= 2094kB time=00:00:08.52 bitrate=2013.5kbits/
frame= 246 fps= 20 q=32.0 size= 2198kB time=00:00:08.88 bitrate=2027.4kbits/
frame= 255 fps= 20 q=33.0 size= 2287kB time=00:00:09.24 bitrate=2027.4kbits/
frame= 264 fps= 20 q=32.0 size= 2383kB time=00:00:09.60 bitrate=2033.1kbits/
frame= 274 fps= 20 q=33.0 size= 2484kB time=00:00:10.00 bitrate=2034.7kbits/
frame= 283 fps= 20 q=32.0 size= 2576kB time=00:00:10.36 bitrate=2037.1kbits/
frame= 293 fps= 20 q=30.0 size= 2653kB time=00:00:10.76 bitrate=2019.9kbits/
frame= 302 fps= 20 q=33.0 size= 2751kB time=00:00:11.12 bitrate=2026.7kbits/
frame= 311 fps= 20 q=32.0 size= 2841kB time=00:00:11.48 bitrate=2027.5kbits/
frame= 318 fps= 19 q=-1.0 Lsize= 3020kB time=00:00:12.64 bitrate=1957.6kbits
/s speed=0.768x
video:1214kB audio:1458kB subtitle:0kB other streams:0kB global headers:0kB muxi
ng overhead: 13.051256%
[libx264 @ 00000000005764c0] frame I:64 Avg QP:20.79 size: 16271
[libx264 @ 00000000005764c0] frame P:79 Avg QP:24.72 size: 1369
[libx264 @ 00000000005764c0] frame B:175 Avg QP:38.37 size: 533
[libx264 @ 00000000005764c0] consecutive B-frames: 24.8% 3.1% 6.6% 65.4%
[libx264 @ 00000000005764c0] mb I I16..4: 62.9% 29.3% 7.7%
[libx264 @ 00000000005764c0] mb P I16..4: 1.6% 0.5% 0.0% P16..4: 3.6% 0.5
% 0.2% 0.0% 0.0% skip:93.5%
[libx264 @ 00000000005764c0] mb B I16..4: 0.1% 0.0% 0.0% B16..8: 3.9% 0.2
% 0.0% direct: 0.0% skip:95.7% L0:38.3% L1:61.5% BI: 0.2%
[libx264 @ 00000000005764c0] 8x8 transform intra:29.3% inter:52.3%
[libx264 @ 00000000005764c0] coded y,uvDC,uvAC intra: 6.4% 2.0% 1.1% inter: 0.2%

0.1% 0.1%

[libx264 @ 00000000005764c0] i16 v,h,dc,p: 83% 15% 2% 0%
[libx264 @ 00000000005764c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 20% 41% 1% 0%

0% 0% 0% 1%

[libx264 @ 00000000005764c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 26% 11% 8% 3%

3% 3% 4% 3%

[libx264 @ 00000000005764c0] i8c dc,h,v,p: 83% 11% 5% 0%
[libx264 @ 00000000005764c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 00000000005764c0] ref P L0: 94.9% 2.5% 1.9% 0.7%
[libx264 @ 00000000005764c0] ref B L0: 89.5% 10.5%
[libx264 @ 00000000005764c0] ref B L1: 90.8% 9.2%
[libx264 @ 00000000005764c0] kb/s:781.62
[aac @ 00000000005b9f00] Qavg: 64972.305
[aac @ 00000000005ba820] Qavg: 64972.305
[aac @ 00000000005bb140] Qavg: 64972.305
[aac @ 0000000003c95980] Qavg: 64972.305
Exiting normally, received signal 2.

comment:3 by thovo, 8 years ago

Analyzed by developer: set
Cc: silvo@gmx.net added
Reproduced by developer: set
Summary: MPEGTS options ignored by RTP_MPEGTS muxersupport options for MPEGTS muxer when using RTP_MPEGTS
Type: defectenhancement
Version: 2.8.3git-master

comment:4 by thovo, 8 years ago

Analysis:
At the moment, format options do not get forwarded from rtp_mpegts to mpegts. So, it is not possible to adjust the mux rate or the PCR interval when using rtp_mpegts.

Possible solution:
To solve this one could extend rtp_mpegts_write_header() in rtpenc_mpegts.c to call avformat_write_header() with the corresponding options when creating the AVFormatContext instance for the mpegts part of the muxing chain.

comment:5 by Ben321, 6 years ago

Has this been fixed yet. The last update to this comment thread was 15 months ago.

comment:6 by lhh92, 6 years ago

I have tried what as suggested by thovo. I recompiled passing a hardcoded muxrate through to the mpegts part of the chain. Solely doing this does not fix the issue. Instead you get an ever increasing bitrate reported. I looked into the issue and it appears to be with the get_pcr command in the mpegtsenc.c file. This value returned increments much slower than when running the same file with the normal mpegts format. Looking at the s->pb it seemed that the data was being written to it in much smaller chunks. I have tried setting the mpegts context pb to that of the rtp_mpegts context and this does remove the issue of every increasing stream bitrate; however, when you analyse the PCR in the output stream it is not correct (it varies)

Suggestions on what where to look next?

	AVDictionary *d = NULL;           // "create" an empty dictionary
	AVDictionaryEntry *t = NULL;
	
	av_dict_set(&d, "mux_rate", "12000000", 0);
	av_dict_set(&d, "muxrate", "12000000", 0);

    for (i = 0; i < s->nb_streams; i++) {
        AVStream* st = avformat_new_stream(mpegts_ctx, NULL);
        if (!st)
            goto fail;
        st->time_base           = s->streams[i]->time_base;
        st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
        avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar);
    }
    if ((ret = avio_open_dyn_buf(&mpegts_ctx->pb)) < 0)
        goto fail;
    if ((ret = avformat_write_header(mpegts_ctx, &d)) < 0)
        goto fail;
    for (i = 0; i < s->nb_streams; i++) {
        s->streams[i]->time_base = mpegts_ctx->streams[i]->time_base;
ffmpeg version N-88512-g5ab41a25ba Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.4.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --enable-static --disable-shared --disable-sse3 --disable-optimizations --disable-stripping --disable-mmx --disable-ssse3 --enable-debug=3
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  1.100 / 58.  1.100
  libavformat    58.  0.102 / 58.  0.102
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.101 /  7.  0.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 2ac04820] decode_slice_header error
[h264 @ 2ac04820] no frame!
[h264 @ 2ac04820] Reinit context to 1280x720, pix_fmt: yuvj420p
[mpegts @ 28fa3e20] max_analyze_duration 5000000 reached at 5013333 microseconds st:1
[mpegts @ 28fa3e20] start time for stream 2 is not set in estimate_timings_from_pts
[mpegts @ 28fa3e20] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from 'remux_test.ts':
  Duration: 00:09:11.39, start: 46592.868000, bitrate: 7789 kb/s
  Program 1
    Metadata:
      service_name    : 1718
      service_provider: Ltd
    Stream #0:0[0xfb]: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuvj420p(pc, progressive, left), 1280x720, 50 fps, 50 tbr, 90k tbn, 100 tbc
    Stream #0:1[0x12d]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 144 kb/s
    Stream #0:2[0x105]: Data: bin_data ([6][0][0][0] / 0x0006)
[udp @ 28fa8b20] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 28fa8c50] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[mpegts @ 28faa4b0]
mpets: mux_rate: 12000000

[mpegts @ 28faa4b0] muxrate 12000000, pcr every 159 pkts, sdt every 3989, pat/pmt every 797 pkts
Output #0, rtp_mpegts, to 'rtp://127.0.0.1:5000':
  Metadata:
    encoder         : Lavf58.0.102
    Stream #0:0: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuvj420p(pc, progressive, left), 1280x720 (0x0), q=2-31, 50 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 144 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=   73 fps= 20 q=-1.0 size=  140714kB time=00:00:01.89 bitrate=609904.1kbits/s speed=0.518x

Last edited 6 years ago by lhh92 (previous) (diff)

comment:7 by Gyan, 3 years ago

Resolution: fixed
Status: newclosed

Feature added in affe911c65022c96bc8ade2ea5f2c09235974c30.

Options can be passed via -mpegts_muxer_options "option1=value1:option2=value2".

Streamid relay added in 325bb04188092f37aceee962f58a4816f0d8e79b.

RTP muxer options can be passed via -rtp_muxer_options "option1=value1:option2=value2".

comment:8 by Wolfgang Bauer, 3 years ago

With the -mpegts_muxer_options it would look like this:

(I've altered the OP's code to emphasize the usage of the new -mpegts_muxer_options.

FYI:

OP's value for mpegts_pmt_start_pid was 0x001E which is 30 in decimal. But minimum is 0x0020 which is 32 in decimal.)

MPEGTS over RTP

ffmpeg -i "input" -c:v libx264 -b:v 1M -b:a 384k ^
-mpegts_muxer_options "muxrate=8000k:mpegts_pmt_start_pid=32:mpegts_transport_stream_id=1:mpegts_original_network_id=65281:mpegts_service_id=1:mpegts_start_pid=256:mpegts_service_type=digital_tv" ^
-metadata service_provider="Provider" -metadata service_name="Service 1" rtp://239.118.0.20:11820?pkt_size=1316

I've added the windows cmd line breaks ^ for readability. Use \ for *nix OS.

Last edited 3 years ago by Wolfgang Bauer (previous) (diff)
Note: See TracTickets for help on using tickets.