Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@deboer-tim
Copy link
Collaborator

@deboer-tim deboer-tim commented Aug 11, 2025

The CDS has a default video handler (MPEG-TS), which can already be changed via the ICPC_VIDEO system property before starting the CDS. e.g. Using 'ICPC_VIDEO=hls' would change all video streaming to HLS.

This change provides a bit more configuration:

  • You can specify which handler to use / override the default using '|url' directly in the CDS config.
  • You can use ',' to separate multiple handlers - e.g. to provide both MPEG-TS and HLS for the same team stream.

For example, the config:
<video desktop="hls|http://localhost:8081,ogg|http://localhost:8082" webcam="http://localhost:9081"/>

Would set up both HLS and OGG streaming for desktop streaming, and MPEG-TS for the webcam:

Video reservation for DESKTOP 70 (HLS) at http://localhost:8081 on stream 417
Video reservation for DESKTOP 70 (OGG) at http://localhost:8082 on stream 418
Video reservation for WEBCAM 70 (MPEG) at http://localhost:9081 on stream 419

And the contest feed would look like this:

{"id":"70",
 "desktop":[
   {"href":"https://10.0.0.198/stream/417","mime":"application/vnd.apple.mpegurl"},
   {"href":"https://10.0.0.198/stream/418","mime":"video/ogg"}],
 "webcam":[
   {"href":"https://10.0.0.198/stream/419","mime":"video/m2ts"}]...}

i.e. the desktop shows two streams and the webcam one, each with correct mime types.

Notes:

  • The main reason for this change was to remove most of the remaining hard-coding/ defaulting from the video streaming pipeline.
  • The secondary point was to make the CDS configurable instead of using system properties. I don't actually think someone would use the config above, it just shows what's possible. e.g. maybe we want to continue to stream MPEG-TS while we also try another format.
  • I used ',' and '|' because I needed characters that don't normally exist in URLs, if anyone has a better suggestion or better config I can switch (or we can do it later).

Copy link
Collaborator

@vmcj vmcj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think , is valid for URLs so I propose to pick something else (see: https://stackoverflow.com/a/7109208) ` seems to be fine though.

Also as a sidenote, I think application/vnd.apple.mpegurl is not valid according to the CLICS spec. If it is I suggest to rephrase it.

@deboer-tim
Copy link
Collaborator Author

I think , is valid for URLs so I propose to pick something else (see: stackoverflow.com/a/7109208) ` seems to be fine though.

desktop="hls|http://localhost:8081ogg|http://localhost:8082"` is kind of awkward though, and easy to think it is a ' if you see an example. Maybe caret ^ is marginally better?
desktop="hls|http://localhost:8081^ogg|http://localhost:8082"
Or we could switch them and do
desktop="hls>http://localhost:8081|ogg>http://localhost:8082"?

Also as a sidenote, I think application/vnd.apple.mpegurl is not valid according to the CLICS spec. If it is I suggest to rephrase it.

Wow, good catch! I opened icpc/ccs-specs#216 and will put up a PR soon since we are trying to release a new version of the spec soon.

The CDS has a default video handler (MPEG-TS), which can already be changed via the
ICPC_VIDEO system property before starting the CDS. e.g. Using 'ICPC_VIDEO=hls' would
change all video streaming to HLS.

This change provides a bit more configuration:
- You can specify which handler to use / override the default using '<name>|url'
  directly in the CDS config.
- You can use ',' to separate multiple handlers - e.g. to provide both MPEG-TS and HLS
  for the same team stream.

For example, the config:
  <video desktop="hls|http://localhost:8081,ogg|http://localhost:8082" webcam="http://localhost:9081"/>

Would set up _both_ HLS and OGG streaming for desktop streaming, and MPEG-TS for the webcam:
  Video reservation for DESKTOP 70 (HLS) at http://localhost:8081 on stream 417
  Video reservation for DESKTOP 70 (OGG) at http://localhost:8082 on stream 418
  Video reservation for WEBCAM 70 (MPEG) at http://localhost:9081 on stream 419

And the contest feed would look like this:
  {"id":"70",
   "desktop":[
     {"href":"https://10.0.0.198/stream/417","mime":"application/vnd.apple.mpegurl"},
     {"href":"https://10.0.0.198/stream/418","mime":"video/ogg"}],
   "webcam":[
     {"href":"https://10.0.0.198/stream/419","mime":"video/m2ts"}]...}
i.e. the desktop shows two streams and the webcam one, each with correct mime types.

Notes:
- The main reason for this change was to remove most of the remaining hard-coding/
  defaulting from the video streaming pipeline.
- The secondary point was to make the CDS configurable instead of using system
  properties. I don't actually think someone would use the config above, it just
  shows what's possible. e.g. maybe we want to continue to stream MPEG-TS while we
  also try another format.
- I used ',' and '|' because I needed characters that don't normally exist in URLs,
  if anyone has a better suggestion or better config I can switch (or we can do it
  later).
@deboer-tim
Copy link
Collaborator Author

Rebased on main and added a new commit to switch the separators to desktop="hls>http://localhost:8081|ogg>http://localhost:8082", let me know if that's ok for now or you have a better suggestion.

@deboer-tim deboer-tim merged commit 25571c6 into icpctools:main Aug 20, 2025
4 checks passed
@deboer-tim deboer-tim deleted the video-handlers branch August 20, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants