Streaming with CasparCG

Hi Guys,

I have a question about streaming with CasparCG-Server. I read alot of comments how to add a stream with ffmpeg. But i have a problem to fill the stream with content.

I have a setup like this:

  • CasparCG-Server 2.2 stable
  • VLC - Player

I add the Stream with this command:
ADD 2 STREAM udp://localhost:1234 -format mpegts -vcodec libx264 -crf 0 -tune zerolatency -preset ultrafast

and im setting up a reciever on VLC with: udp://@:1234

After this, VLC is recieving from CasparCG but i cant see something. So I guess, that my stream from Caspar is empty.
Now my question is: How can I add Content to the stream?

Maybe my thoughts are on a wrong way and you guys can help me. Our later goal of streaming is to stream an incoming SDI-signal to various IP-adresses.

Thanks for helping!


1 Like

first of all with this ADD 2 command you are going to stream Channel 2 so confirm that your channel 2 is not empty.
second i don’t think that your streaming parameters are acceptable with 2.2 build. In server 2.2 ffmpeg updated with updated version so parameters are change in 2.2 so i’m sure you must be getting warning after adding stream check console for this.

you can try with

ADD 1 STREAM udp://localhost:1234 -format mpegts -codec:v libx264 -crf:v 0 -tune:v zerolatency -preset:v ultrafast

Yes i know - but thanks for this hint.

for me first testcase i just added a picture to layer 1 on channel 2. But i couldnt see it on my stream.

I tried this command and i didnt get any warnings like beofre. Thanks for that. But now vlc cant recieve anything and stays in search mode.

Maybe i have to smth in my config? I still have the standard one.

Am I getting it right? Normally you fill your layer with content as you want and then you add a stream with this command to your channel and it should now stream your whole channel content?

Thanks for your reply and help!


check console window for info/error

i’m testing it right now with same command and working fine on VLC

console info is:

[2019-04-10 20:42:48.106] [info]    Received message from Console: ADD 1 STREAM udp://localhost:1234 -format mpegts -codec:v libx264 -crf:v 0 -tune:v zerolatency -preset:v ultrafast\r\n
#202 ADD OK
[2019-04-10 20:42:48.108] [info]    ffmpeg[udp://localhost:1234] Initialized.
[2019-04-10 20:42:48.109] [info]    [ffmpeg] [libx264 @ 0000000002742E40] using SAR=64/45
[2019-04-10 20:42:48.109] [info]
[2019-04-10 20:42:48.114] [info]    [ffmpeg] [libx264 @ 0000000002742E40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[2019-04-10 20:42:48.114] [info]
[2019-04-10 20:42:48.117] [info]    [ffmpeg] [libx264 @ 0000000002742E40] profile High 4:4:4 Predictive, level 3.1, 4:2:2, 8-bit
[2019-04-10 20:42:48.117] [info]

config is your default preset like if you want to start streaming with server start you can set it in config settings.

ok, I get the same console info like you. But my VLC is not recieving anything…

Anyways - thanks for your help!


Test using “” instead of localhost.

Thanks for this idea - but its the same result :confused:


Hi Guys - Im still struggling with streaming and CasparCG.

I get a weird exception, when i want to add a stream to youtube:

[2019-05-17 15:30:23.892] [info]    ffmpeg[rtmp://(Stream Name)@(Server URL)] Initialized.
[2019-05-17 15:30:23.893] [info]    [ffmpeg] [libx264 @ 0000018758520080] using SAR=1/1
[2019-05-17 15:30:23.893] [info]
[2019-05-17 15:30:23.894] [info]    [ffmpeg] [libx264 @ 0000018758520080] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[2019-05-17 15:30:23.894] [info]
[2019-05-17 15:30:23.896] [info]    [ffmpeg] [libx264 @ 0000018758520080] profile High 4:2:2, level 3.2, 4:2:2 8-bit
[2019-05-17 15:30:23.896] [info]
[2019-05-17 15:30:24.583] [error]   Exception: C:\Program Files (x86)\Jenkins\workspace\casparcg-server-dep\2.2.x\src\modules\ffmpeg\consumer\ffmpeg_consumer.cpp(580): Throw in function auto __cdecl caspar::ffmpeg::ffmpeg_consumer::initialize::<lambda_e201b6f5f8931444e6d9c1015de83729>::operator ()(void) const
[2019-05-17 15:30:24.583] [error]   Dynamic exception type: class boost::exception_detail::clone_impl<struct caspar::ffmpeg::ffmpeg_error_t>
[2019-05-17 15:30:24.583] [error]   [struct boost::errinfo_api_function_ * __ptr64] = avio_open2(&oc->pb, full_path.string().c_str(), 2, nullptr, &dict)
[2019-05-17 15:30:24.583] [error]   [struct boost::errinfo_errno_ * __ptr64] = 5, "Input/output error"
[2019-05-17 15:30:24.583] [error]   [struct caspar::tag_stacktrace_info * __ptr64] =  0# 0x00007FF780A598AE in casparcg
[2019-05-17 15:30:24.583] [error]    1# 0x00007FF780A88C50 in casparcg
[2019-05-17 15:30:24.583] [error]    2# 0x00007FF780C32DE6 in casparcg
[2019-05-17 15:30:24.583] [error]    3# 0x00007FF780C35450 in casparcg
[2019-05-17 15:30:24.583] [error]    4# 0x00007FF780A545C9 in casparcg
[2019-05-17 15:30:24.583] [error]    5# o_exp in ucrtbase
[2019-05-17 15:30:24.583] [error]    6# BaseThreadInitThunk in KERNEL32
[2019-05-17 15:30:24.583] [error]    7# RtlUserThreadStart in ntdll
[2019-05-17 15:30:24.583] [error]
[2019-05-17 15:30:24.583] [error]
[2019-05-17 15:30:24.583] [error]    0# 0x00007FF780A598AE in casparcg
[2019-05-17 15:30:24.583] [error]    1# 0x00007FF780A591DF in casparcg
[2019-05-17 15:30:24.583] [error]    2# 0x00007FF780F30F37 in casparcg
[2019-05-17 15:30:24.583] [error]    3# _C_specific_handler in VCRUNTIME140
[2019-05-17 15:30:24.583] [error]    4# _TypeMatch in VCRUNTIME140
[2019-05-17 15:30:24.583] [error]    5# RtlCaptureContext in ntdll
[2019-05-17 15:30:24.583] [error]    6# 0x00007FF780B476BA in casparcg
[2019-05-17 15:30:24.583] [error]    7# 0x00007FF780B480F5 in casparcg
[2019-05-17 15:30:24.583] [error]    8# 0x00007FF780B22E1D in casparcg
[2019-05-17 15:30:24.583] [error]    9# 0x00007FF780B26050 in casparcg
[2019-05-17 15:30:24.583] [error]   10# 0x00007FF780A545C9 in casparcg
[2019-05-17 15:30:24.583] [error]   11# o_exp in ucrtbase
[2019-05-17 15:30:24.583] [error]   12# BaseThreadInitThunk in KERNEL32
[2019-05-17 15:30:24.583] [error]   13# RtlUserThreadStart in ntdll
[2019-05-17 15:30:24.583] [error]

Following line is the command im using:
add 1 stream rtmp://(Stream Name)@(ServerURL) -format mpegts -codec:v libx264 -crf:v 0 -tune:v zerolatency -present:v ultrafast

I cant figure out what the problem is, maybe you can help me.

Thanks, Norman

This is not a standard URI for RTMP: rtmp://(Stream Name)@(ServerURL)

Hi all,

I have similar problem. I have started server and client, in client I have made playlist with one picture. Than I started playing on server and put following command into command line:

ADD 1 STREAM “udp://” -f mpegts -acodec libvo_aacenc -ac 2 -ar 48000 -ab 192k -vcodec libx264 -preset veryfast -threads 2

Than I put “udp://@:9999” into VLC. On timeline time is running, but no picture playing.


Thanks, but if I put it like that:

ADD 1 STREAM “udp://” -f mpegts -acodec libvo_aacenc -ac 2 -ar 48000 -ab 192k -vcodec libx264 -preset veryfast -threads 2 -pix_fmt yuv420p

I got this mesage:

[2019-08-02 20:28:12.921] [6976] [warning] Invalid option: -pix_fmt yuv420p

Maybe basic questions, but I just instaled CasparCG today, so I am little bit lost in it :smiley:

Everything after -f is parsed as output container options. Try it with -f mpegts last.

I have tried, it seems to take parameters if it is like this.

ADD 1 STREAM “udp://” format=pix_fmts=yuv420p -f mpegts -acodec libvo_aacenc -ac 2 -ar 48000 -ab 192k -vcodec libx264 -preset veryfast -threads 2

but in command line it gives message with yuv444p

[2019-08-04 20:06:16.757] [8320]  [info]    [ffmpeg] Output #0, mpegts, to 'udp://':
[2019-08-04 20:06:16.763] [8320]  [info]    [ffmpeg]   Metadata:
[2019-08-04 20:06:16.765] [8320]  [info]    [ffmpeg]     encoder         :
[2019-08-04 20:06:16.767] [8320]  [info]    [ffmpeg] Lavf55.33.10
[2019-08-04 20:06:16.769] [8320]  [info]    [ffmpeg]
[2019-08-04 20:06:16.773] [8320]  [info]    [ffmpeg]     Stream #0:
[2019-08-04 20:06:16.776] [8320]  [info]    [ffmpeg] : Video: h264 (libx264), yuv444p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 192 kb/

and in VLC I have still black screen.

I tested follwing command to work in lattest server dated 01.06.19

ADD 1 STREAM udp:// -codec:v libx264 -tune:v zerolatency -preset:v ultrafast -crf:v 25 -format mpegts

thanks @vimlesh1975, but are you also able to play it in vlc?

Yes certainly.

1 Like

Hi @vimlesh1975 have you ever tried to connect a wifi GoPro or Apeman and try to restream it on CasparCG?
Is that even possible you think?



Latest stable version of ffmpeg, (in Caspar 2.0.7 Stable) seems
to not support -crf:v 25 which should be frame rate parameter, it work thought, when ommited.
I’ve just had to add ?pkt_size=1316 to end of path. (Check compatibility with your network’s MTU)

So my final configuration is:

ADD 1 STREAM udp:// -codec:v libx264 -tune:v zerolatency -preset:v ultrafast -format mpegts
# VLC (open stream) v3.0.12
# Didn't work without "@" which is weird

This output stream can be also set in casparcg.config

      <args>-codec:v libx264 -tune:v zerolatency -preset:v ultrafast -format mpegts</args>

And if someone looks for alpha channel streaming,
just add ffmpeg parameter -vf alphaextract to stream

Just to sumarize, for people struggling with streams, like me :slight_smile: