Bug: Some arguments not implemented UDP TS consumer
Observed Behavior
I tried to create the simplest udp streaming example I could for testing purposes.
With libx264 UDP the udp streaming output works (config file form)
<ffmpeg> <path>udp://localhost:2037?pkt_size=1316</path> <args>-filter:v format=pix_fmts=yuv420p -codec:v libx264 -bufsize:v 9M -minrate:v 9M -maxrate:v 9M -codec:a ac3 -filter:a pan=stereo|c0=c0|c1=c1 -b:a 128k -format mpegts</args> </ffmpeg>
With mpeg2video it throws errors even though this should work fine in ffmpeg directly.
<ffmpeg>
<path>udp://localhost:2037?pkt_size=1316</path>
<args>-filter:v format=pix_fmts=yuv420p -codec:v mpeg2video -bufsize:v 9M -minrate:v 9M -maxrate:v 9M -codec:a ac3 -filter:a pan=stereo|c0=c0|c1=c1 -b:a 128k -format mpegts</args>
</ffmpeg>
F:\RLB\CasparCG\casparcg-server-v2.3.3-lts-stable>casparcg
[2025-06-22 01:41:34.959111] [0x00009394] [error] 0# 0x00007FF66A15B906 in casparcg
1# 0x00007FF66A16F080 in casparcg
2# raise in ucrtbase
3# abort in ucrtbase
4# 0x00007FF66A16F55E in casparcg
5# terminate in ucrtbase
6# is_exception_typeof in VCRUNTIME140
7# is_exception_typeof in VCRUNTIME140
8# _CxxFrameHandler3 in VCRUNTIME140
9# _chkstk in ntdll
10# RtlRaiseException in ntdll
11# RtlRaiseException in ntdll
12# RaiseException in KERNELBASE
13# CxxThrowException in VCRUNTIME140
14# 0x00007FF66A1FFB6F in casparcg
15# 0x00007FF66A401D04 in casparcg
16# 0x00007FF66A402E2A in casparcg
17# 0x00007FF66A414C37 in casparcg
18# 0x00007FF66A40FC97 in casparcg
19# 0x00007FF66A24DA20 in casparcg
20# 0x00007FF66A24ED94 in casparcg
21# 0x00007FF66A2BBE05 in casparcg
22# 0x00007FF66A2AD854 in casparcg
23# 0x00007FF66A2B2EFC in casparcg
24# 0x00007FF66A2A52CF in casparcg
25# 0x00007FF66A2AC0F7 in casparcg
26# 0x00007FF66A262474 in casparcg
27# 0x00007FF66A2628B8 in casparcg
28# 0x00007FF66A2D20A4 in casparcg
29# 0x00007FF66A2D2FEF in casparcg
30# 0x00007FF66A2D2497 in casparcg
31# 0x00007FF66A2D2797 in casparcg
32# 0x00007FF66A18DA82 in casparcg
33# 0x00007FF66A2C67D3 in casparcg
34# 0x00007FF66A2C69BE in casparcg
35# 0x00007FF66A2C70C4 in casparcg
36# 0x00007FF66A2CDCF6 in casparcg
37# 0x00007FF66A164258 in casparcg
38# 0x00007FF66A16DBED in casparcg
39# 0x00007FF66A17111D in casparcg
40# 0x00007FF66A5A6A88 in casparcg
41# BaseThreadInitThunk in KERNEL32
42# RtlUserThreadStart in ntdll
Type "q" to close application.
Logging [info] or higher severity to log/
[2025-06-22 01:41:34.985] [info] ############################################################################
[2025-06-22 01:41:34.985] [info] CasparCG Server is distributed by the Swedish Broadcasting Corporation (SVT)
[2025-06-22 01:41:34.985] [info] under the GNU General Public License GPLv3 or higher.
[2025-06-22 01:41:34.985] [info] Please see LICENSE.TXT for details.
[2025-06-22 01:41:34.985] [info] http://www.casparcg.com/
[2025-06-22 01:41:34.985] [info] ############################################################################
[2025-06-22 01:41:34.985] [info] Starting CasparCG Video and Graphics Playout Server 2.3.2 4de6d18f Dev
[2025-06-22 01:41:35.301] [info] Initializing OpenGL Device.
[2025-06-22 01:41:35.302] [info] Initialized OpenGL 4.5.0 NVIDIA 553.35 NVIDIA Corporation
[2025-06-22 01:41:35.302] [info] Initialized image module.
[2025-06-22 01:41:35.306] [info] Initialized ffmpeg module.
[2025-06-22 01:41:35.306] [info] Initialized oal module.
[2025-06-22 01:41:35.306] [info] Initialized decklink module.
[2025-06-22 01:4[0622/014135.346:ERROR:gpu_process_transport_factory.cc(990)] Lost UI shared context.
1:35.306] [info] Initialized screen module.
[2025-06-22 01:41:35.306] [info] Initialized newtek module.
[2025-06-22 01:41:35.399] [info] Initialized html module.
[2025-06-22 01:41:35.400] [info] Flash support is disabled
[2025-06-22 01:41:35.400] [info] Initialized flash module.
[2025-06-22 01:41:35.403] [info] Initialized bluefish module.
[2025-06-22 01:41:35.403] [info] "F:/RLB\CasparCG\casparcg-server-v2.3.3-lts-stable\casparcg.config":
[2025-06-22 01:41:35.403] [info] -----------------------------------------
[2025-06-22 01:41:35.403] [info] <?xml version="1.0" encoding="utf-8"?>
[2025-06-22 01:41:35.403] [info] <configuration>
[2025-06-22 01:41:35.403] [info] <paths>
[2025-06-22 01:41:35.403] [info] <media-path>Z:\Playout\Media</media-path>
[2025-06-22 01:41:35.403] [info] <log-path>log/</log-path>
[2025-06-22 01:41:35.403] [info] <data-path>data/</data-path>
[2025-06-22 01:41:35.403] [info] <template-path>Z:\Playout\Templates</template-path>
[2025-06-22 01:41:35.403] [info] </paths>
[2025-06-22 01:41:35.403] [info] <lock-clear-phrase>secret</lock-clear-phrase>
[2025-06-22 01:41:35.403] [info] <channels>
[2025-06-22 01:41:35.403] [info] <channel>
[2025-06-22 01:41:35.403] [info] <video-mode>1080i5994</video-mode>
[2025-06-22 01:41:35.403] [info] <consumers>
[2025-06-22 01:41:35.403] [info] <decklink>
[2025-06-22 01:41:35.403] [info] <device>1</device>
[2025-06-22 01:41:35.403] [info] <key-device>1</key-device>
[2025-06-22 01:41:35.403] [info] <embedded-audio>true</embedded-audio>
[2025-06-22 01:41:35.403] [info] <latency>normal</latency>
[2025-06-22 01:41:35.403] [info] <keyer>internal</keyer>
[2025-06-22 01:41:35.403] [info] <key-only>false</key-only>
[2025-06-22 01:41:35.403] [info] <buffer-depth>3</buffer-depth>
[2025-06-22 01:41:35.403] [info] </decklink>
[2025-06-22 01:41:35.403] [info] <ffmpeg>
[2025-06-22 01:41:35.403] [info] <path>udp://localhost:2037?pkt_size=1316</path>
[2025-06-22 01:41:35.403] [info] <args>-filter:v format=pix_fmts=yuv420p -codec:v mpeg2video -bufsize:v 9M -minrate:v 9M -maxrate:v 9M -codec:a ac3 -filter:a pan=stereo|c0=c0|c1=c1 -b:a 128k -format mpegts</args>
[2025-06-22 01:41:35.403] [info] </ffmpeg>
[2025-06-22 01:41:35.403] [info] </consumers>
[2025-06-22 01:41:35.403] [info] </channel>
[2025-06-22 01:41:35.403] [info] </channels>
[2025-06-22 01:41:35.403] [info] <controllers>
[2025-06-22 01:41:35.403] [info] <tcp>
[2025-06-22 01:41:35.403] [info] <port>5250</port>
[2025-06-22 01:41:35.403] [info] <protocol>AMCP</protocol>
[2025-06-22 01:41:35.403] [info] </tcp>
[2025-06-22 01:41:35.403] [info] </controllers>
[2025-06-22 01:41:35.403] [info] <amcp>
[2025-06-22 01:41:35.403] [info] <media-server>
[2025-06-22 01:41:35.403] [info] <host>localhost</host>
[2025-06-22 01:41:35.403] [info] <port>8000</port>
[2025-06-22 01:41:35.403] [info] </media-server>
[2025-06-22 01:41:35.403] [info] </amcp>
[2025-06-22 01:41:35.403] [info] </configuration>
[2025-06-22 01:41:35.403] [info] -----------------------------------------
[2025-06-22 01:41:35.477] [info] Initialized OpenGL Accelerated GPU Image Mixer for channel 1
[2025-06-22 01:41:35.478] [info] video_channel[1|1080i5994] Successfully Initialized.
[2025-06-22 01:41:35.487] [info] DeckLink SDI 4K [1-1|1080i5994] Enabled embedded-audio.
[2025-06-22 01:41:35.487] [info] DeckLink SDI 4K [1-1|1080i5994] Disabled low-latency mode.
[2025-06-22 01:41:35.487] [info] DeckLink SDI 4K [1-1|1080i5994] Enabled internal keyer.
[2025-06-22 01:41:35.491] [info] DeckLink SDI 4K [1-1|1080i5994] Initialized.
[2025-06-22 01:41:35.492] [info] ffmpeg[udp://localhost:2037?pkt_size=1316] Initialized.
[2025-06-22 01:41:35.492] [info] Initialized channels.
[2025-06-22 01:41:35.493] [info] Initialized controllers.
[2025-06-22 01:41:35.493] [info] Initialized osc.
[2025-06-22 01:41:35.493] [error] [ffmpeg] [mpeg2video @ 00000265FFFA7AC0] bitrate below min bitrate
[2025-06-22 01:41:35.493] [error]
[2025-06-22 01:41:35.556] [info] DeckLink SDI 4K [1-1|1080i5994] Reference signal: not detected.
[2025-06-22 01:41:35.804] [info] async_event_server[:5250] Accepted connection from 127.0.0.1 (1 connections).
[2025-06-22 01:41:35.804] [info] async_event_server[:5250] Accepted connection from 127.0.0.1 (2 connections).
[2025-06-22 01:41:35.806] [info] Received message from 127.0.0.1: REQ sdwtlba CLS\r\n
[2025-06-22 01:41:35.806] [info] Received message from 127.0.0.1: REQ r7eejd7 INFO\r\n
[2025-06-22 01:41:35.505] [error] Exception: C:\Program Files (x86)\Jenkins\workspace\casparcg-server-dep\master\src\modules\ffmpeg\consumer\ffmpeg_consumer.cpp(305): Throw in function auto __cdecl caspar::ffmpeg::Stream::{ctor}::<lambda_185aeed21664c9a2fdb8a20d8dc8b169>::operator ()(void) const
[2025-06-22 01:41:35.505] [error] Dynamic exception type: class boost::exception_detail::clone_impl<struct caspar::ffmpeg::ffmpeg_error_t>
[2025-06-22 01:41:35.505] [error] [struct boost::errinfo_api_function_ * __ptr64] = avcodec_open2(enc.get(), codec, &dict)
[2025-06-22 01:41:35.505] [error] [struct boost::errinfo_errno_ * __ptr64] = 1, "Operation not permitted"
[2025-06-22 01:41:35.505] [error] [struct caspar::ffmpeg::tag_ffmpeg_errn_info * __ptr64] = -1
[2025-06-22 01:41:35.505] [error] [struct caspar::tag_stacktrace_info * __ptr64] = 0# 0x00007FF66A16A37E in casparcg
[2025-06-22 01:41:35.505] [error] 1# 0x00007FF66A199690 in casparcg
[2025-06-22 01:41:35.505] [error] 2# 0x00007FF66A37060C in casparcg
[2025-06-22 01:41:35.505] [error] 3# 0x00007FF66A364E0B in casparcg
[2025-06-22 01:41:35.505] [error] 4# 0x00007FF66A376B60 in casparcg
[2025-06-22 01:41:35.505] [error] 5# 0x00007FF66A37B730 in casparcg
[2025-06-22 01:41:35.505] [error] 6# 0x00007FF66A1650B9 in casparcg
[2025-06-22 01:41:35.505] [error] 7# configthreadlocale in ucrtbase
[2025-06-22 01:41:35.505] [error] 8# BaseThreadInitThunk in KERNEL32
[2025-06-22 01:41:35.505] [error] 9# RtlUserThreadStart in ntdll
[2025-06-22 01:41:35.505] [error]
[2025-06-22 01:41:35.505] [error]
[2025-06-22 01:41:35.505] [error] 0# 0x00007FF66A16A37E in casparcg
[2025-06-22 01:41:35.505] [error] 1# 0x00007FF66A169CAF in casparcg
[2025-06-22 01:41:35.505] [error] 2# 0x00007FF66A6962A7 in casparcg
[2025-06-22 01:41:35.505] [error] 3# _CxxFrameHandler3 in VCRUNTIME140
[2025-06-22 01:41:35.505] [error] 4# is_exception_typeof in VCRUNTIME140
[2025-06-22 01:41:35.505] [error] 5# RtlCaptureContext2 in ntdll
[2025-06-22 01:41:35.505] [error] 6# 0x00007FF66A26C14D in casparcg
[2025-06-22 01:41:35.505] [error] 7# 0x00007FF66A26CBD5 in casparcg
[2025-06-22 01:41:35.505] [error] 8# 0x00007FF66A263997 in casparcg
[2025-06-22 01:41:35.505] [error] 9# 0x00007FF66A2666E0 in casparcg
[2025-06-22 01:41:35.505] [error] 10# 0x00007FF66A1650B9 in casparcg
[2025-06-22 01:41:35.505] [error] 11# configthreadlocale in ucrtbase
[2025-06-22 01:41:35.505] [error] 12# BaseThreadInitThunk in KERNEL32
[2025-06-22 01:41:35.505] [error] 13# RtlUserThreadStart in ntdll
[2025-06-22 01:41:35.505] [error]
[2025-06-22 01:41:36.541] [error] Exception: C:\Program Files (x86)\Jenkins\workspace\casparcg-server-dep\master\src\modules\ffmpeg\consumer\ffmpeg_consumer.cpp(305): Throw in function auto __cdecl caspar::ffmpeg::Stream::{ctor}::<lambda_185aeed21664c9a2fdb8a20d8dc8b169>::operator ()(void) const
[2025-06-22 01:41:36.541] [error] Dynamic exception type: class boost::exception_detail::clone_impl<struct caspar::ffmpeg::ffmpeg_error_t>
[2025-06-22 01:41:36.541] [error] [struct boost::errinfo_api_function_ * __ptr64] = avcodec_open2(enc.get(), codec, &dict)
[2025-06-22 01:41:36.541] [error] [struct boost::errinfo_errno_ * __ptr64] = 1, "Operation not permitted"
[2025-06-22 01:41:36.541] [error] [struct caspar::ffmpeg::tag_ffmpeg_errn_info * __ptr64] = -1
[2025-06-22 01:41:36.541] [error] [struct caspar::tag_stacktrace_info * __ptr64] = 0# 0x00007FF66A16A37E in casparcg
[2025-06-22 01:41:36.541] [error] 1# 0x00007FF66A199690 in casparcg
[2025-06-22 01:41:36.541] [error] 2# 0x00007FF66A37060C in casparcg
[2025-06-22 01:41:36.541] [error] 3# 0x00007FF66A364E0B in casparcg
[2025-06-22 01:41:36.541] [error] 4# 0x00007FF66A376B60 in casparcg
[2025-06-22 01:41:36.541] [error] 5# 0x00007FF66A37B730 in casparcg
[2025-06-22 01:41:36.541] [error] 6# 0x00007FF66A1650B9 in casparcg
[2025-06-22 01:41:36.541] [error] 7# configthreadlocale in ucrtbase
[2025-06-22 01:41:36.541] [error] 8# BaseThreadInitThunk in KERNEL32
[2025-06-22 01:41:36.541] [error] 9# RtlUserThreadStart in ntdll
[2025-06-22 01:41:36.541] [error]
[2025-06-22 01:41:36.541] [error]
[2025-06-22 01:41:36.541] [error] 0# 0x00007FF66A16A37E in casparcg
[2025-06-22 01:41:36.541] [error] 1# 0x00007FF66A169CAF in casparcg
[2025-06-22 01:41:36.541] [error] 2# 0x00007FF66A6962A7 in casparcg
[2025-06-22 01:41:36.541] [error] 3# _CxxFrameHandler3 in VCRUNTIME140
[2025-06-22 01:41:36.541] [error] 4# is_exception_typeof in VCRUNTIME140
[2025-06-22 01:41:36.541] [error] 5# RtlCaptureContext2 in ntdll
[2025-06-22 01:41:36.541] [error] 6# 0x00007FF66A26C14D in casparcg
[2025-06-22 01:41:36.541] [error] 7# 0x00007FF66A26CBD5 in casparcg
[2025-06-22 01:41:36.541] [error] 8# 0x00007FF66A263997 in casparcg
[2025-06-22 01:41:36.541] [error] 9# 0x00007FF66A2666E0 in casparcg
[2025-06-22 01:41:36.541] [error] 10# 0x00007FF66A1650B9 in casparcg
[2025-06-22 01:41:36.541] [error] 11# configthreadlocale in ucrtbase
[2025-06-22 01:41:36.541] [error] 12# BaseThreadInitThunk in KERNEL32
[2025-06-22 01:41:36.541] [error] 13# RtlUserThreadStart in ntdll`
Expected behaviour
I would expect it to output mpeg2video with default settings other than what is specified.
Steps to reproduce
1.Add the following to consumers definition in config file
<ffmpeg>
<path>udp://localhost:2037?pkt_size=1316</path>
<args>-filter:v format=pix_fmts=yuv420p -codec:v mpeg2video -bufsize:v 9M -minrate:v 9M -maxrate:v 9M -codec:a ac3 -filter:a pan=stereo|c0=c0|c1=c1 -b:a 128k -format mpegts</args>
</ffmpeg>
- FFmpeg consumer refuses to run
Environment
- Server version: 2.3.3
- Operating system: Windows 10
If needed, I can also test on master on linux if anything has changed since 2.3.3 for this.
After testing on linux from a development branch based on master, I discovered that it doesn't like having the minrate and maxrate variables without setting the bit rate. I now have a command that streams video but no matter what I do the quality seems to be less than the equivilant command in ffmpeg directly. This holds true for 2.3.3 on windows also.
Using a simplified test:
<ffmpeg> <path>udp://localhost:2037?pkt_size=1316</path> <args>-filter:v scale=1920x1080,fps=30000/1001,format=pix_fmts=yuv420p -codec:v mpeg2video -interlaced_scan 1 -dc 10 -flags +ilme+ildct -profile:v 1 -level:v 4 -b:v 9.5M -minrate 9.5M -maxrate 9.5M -bufsize 9.5M -bf 0 -codec:a ac3 -ar 48000 -ac 2 -filter:a pan=stereo|c0=c0|c1=c1 -b:a 192k -format mpegts</args> </ffmpeg>
It appears like some important mpeg2 options are not processed.
[2025-06-22 12:41:13.216] [info] [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option ac=2 [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option ar=48000 [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option bf=0 [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option bufsize=9.5M [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option dc=10 [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option flags=+ilme+ildct [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option interlaced_scan=1 [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option maxrate=9.5M [2025-06-22 12:41:13.220] [warning] ffmpeg[udp://localhost:2037?pkt_size=1316] Unused option minrate=9.5M
Here are the arguments I normally use when transcoding files.
-y -i "<SourceFileName>"
-f mpegts
-mpegts_transport_stream_id 10131 -metadata service_provider="Network Name"
-metadata service_name="ChName" -mpegts_service_id 1 -tables_version 10
-vcodec mpeg2video -flags +ilme+ildct
-vf fps=30000/1001,scale=1920x1080 -pix_fmt yuv420p
-muxrate 19000k -g 15
-b:v 12000k -minrate:v 12000k -maxrate:v 12000k -bufsize 12000k
-mbd bits -lmin QP2LAMBDA
-me_method epzs -bf 2 -b_strategy 1
-trellis 5 -cmp 2 -subcmp 2 -sc_threshold 1000000k
-packetsize 188 -mpegts_pmt_start_pid 0x40 -mpegts_start_pid 0x44
-c:a ac3
-ar 48000 -b:a 120k
-threads 0
"<OutputPath><OutputFileName>.ts"