Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

CTR Streaming Server 3DS: Difference between revisions

From GameBrew
No edit summary
No edit summary
Line 8: Line 8:
|version=Beta
|version=Beta
|license=Mixed
|license=Mixed
|download=https://dlhb.gamebrew.org/3dshomebrew/ctr-streaming-server-master.zip
|download=https://dlhb.gamebrew.org/3dshomebrews/ctrstreamingserver.7z Source Only
|website=https://github.com/yellows8/ctr-streaming-server/
|website=https://github.com/yellows8/ctr-streaming-server
|source=https://github.com/yellows8/ctr-streaming-server/
|source=https://github.com/yellows8/ctr-streaming-server
}}
}}
<youtube>SmJeh8BUtpg</youtube>
This is a 3DS homebrew audio/video playback server, listening on TCP port 8334. This uses ctrulib.
This is a 3DS homebrew audio/video playback server, listening on TCP port 8334. This uses ctrulib.


Compiling: ''make MEDIAMODE=<val> CODEC=<val> HIDREPORT=<val>''
==User guide==
 
Compiling: <code> make MEDIAMODE=<val> CODEC=<val> HIDREPORT=<val></code>
'''MEDIAMODE''' must be either value 0 for video, or value 1 for audio.
* MEDIAMODE must be either value 0 for video, or value 1 for audio.
CODEC must be either value 0 for raw video/audio, or value 1 for encoded video/audio.
* CODEC must be either value 0 for raw video/audio, or value 1 for encoded video/audio.
 
* HIDREPORT is optional, when the value is non-zero and MEDIAMODE is 0, the server will send a 0x10c-byte block to the client every >= ~1/60 of a second. The first 0x108-bytes are from hidSharedMem+0, the last word is from [http://3dbrew.org/wiki/Configuration_Memory#3D_SLIDERSTATE here]. The app will only send the HID block while video data is being received.
'''HIDREPORT''' is optional, when the value is non-zero and MEDIAMODE is 0, the server will send a 0x10c-byte block to the client every >= ~1/60 of a second. The first 0x108-bytes are from hidSharedMem+0, the last word is from here: http://3dbrew.org/wiki/Configuration_Memory#3D_SLIDERSTATE The app will only send the HID block while video data is being received.


Besides ctrulib, the following libraries are required: libvpx, libvorbisfile, libvorbis, and libogg.
Besides ctrulib, the following libraries are required: libvpx, libvorbisfile, libvorbis, and libogg.
Configuring libvpx building: CROSS=arm-none-eabi- ./configure --target=generic-gnu "--extra-cflags=-march=armv6 -mtune=mpcore -mfpu=vfp" --disable-multithread --disable-vp8-encoder --disable-vp9-encoder
* Configuring libvpx building: <code> CROSS=arm-none-eabi- ./configure --target=generic-gnu "--extra-cflags=-march=armv6 -mtune=mpcore -mfpu=vfp" --disable-multithread --disable-vp8-encoder --disable-vp9-encoder </code>
Configuring libogg building: ./configure --host=arm-none-eabi --prefix=/opt/devkitpro/devkitARM/portlibs/arm/armv6
* Configuring libogg building: <code> ./configure --host=arm-none-eabi --prefix=/opt/devkitpro/devkitARM/portlibs/arm/armv6</code>


The audio is 44100Hz pcm_s16le mono-channel, when CODEC is non-zero the data sent to the app must be .ogg.
The audio is 44100Hz pcm_s16le mono-channel, when CODEC is non-zero the data sent to the app must be .ogg.
When CODEC is non-zero, the video data sent to the app must be VP8 IVF. The color-format of the video frame is the same as the LCD framebuffer, the width must be 240. For raw video, the color-format is RGB565.
* When CODEC is non-zero, the video data sent to the app must be VP8 IVF.  
* The color-format of the video frame is the same as the LCD framebuffer, the width must be 240. For raw video, the color-format is RGB565.


The height must be at least 320(sub-screen) or 400(main-screen). For encoded video, larger height values allows more than one LCD framebuffer to be used in each video frame. 320+400 = main-screen image(400 height) + sub-screen image(320 height), 800 = two main-screen images(height 400 for each image), for 3D left and 3D right. 800+320 = same as 800, except this has a 320-height sub-screen image following the main-screen images.
The height must be at least 320(sub-screen) or 400(main-screen).  
* For encoded video, larger height values allows more than one LCD framebuffer to be used in each video frame.  
* 320+400 = main-screen image(400 height) + sub-screen image(320 height), 800 = two main-screen images(height 400 for each image), for 3D left and 3D right.  
* 800+320 = same as 800, except this has a 320-height sub-screen image following the main-screen images.


The VP8 video framerate from the client should be only ~20-25fps(this depends on the video dimensions), this is due to single-threaded decoding(higher framerates can't be used due to this not decoding fast enough).
The VP8 video framerate from the client should be only ~20-25fps(this depends on the video dimensions), this is due to single-threaded decoding(higher framerates can't be used due to this not decoding fast enough).
Line 36: Line 37:
This app handles certain errors by triggering crashes. Note that this includes service initialization failure(such as CSND), like when the app doesn't have access to a required service.
This app handles certain errors by triggering crashes. Note that this includes service initialization failure(such as CSND), like when the app doesn't have access to a required service.


==Example terminal commands for streaming to this server:==
Example terminal commands for streaming to this server:
* Ogg streaming: <code> avconv -i <inputfile> -f s16le -acodec libvorbis -ac 1 -vn -f ogg - | nc <serveraddr> 8334 </code>
* Raw audio streaming: <code> avconv -i <inputfile> -f s16le -acodec pcm_s16le -ac 1 - | nc <serveraddr> 8334 </code>
* VP8 IVF, for just sub-screen: <code> avconv -i <video input path> -s 320x240 -vf transpose=1 -r 30 -f ivf - | nc <serveraddr> 8334 </code>
 
==Known issues==
This has various bugs, including:
* Return-to-homemenu(which includes power-button handling) does not work, returning to hbmenu is broken too.
* Audio playback starting when the initial connection is closed then another connection opened, is broken. The app does not hang/crash(closing the connection + opening the connection again still works), however no audio is played.
* Ogg handling is broken, this doesn't work very well compared to raw audio playback. Unlike raw audio playback, the app will quickly hang without crashing, when playing ogg audio.
* This app only waits for just one audio chunk(1-second block), then immediately plays that. This results in audio playback briefly stopping while the app waits for the next chunk when playback of the previous chunk already finished.


''Ogg streaming: avconv -i <inputfile> -f s16le -acodec libvorbis -ac 1 -vn -f ogg - | nc <serveraddr> 8334
==Credits==
Raw audio streaming: avconv -i <inputfile> -f s16le -acodec pcm_s16le -ac 1 - | nc <serveraddr> 8334
The yuv2rgb code used by this app is from [http://wss.co.uk/pinknoise/yuv2rgb/ here].
VP8 IVF, for just sub-screen: avconv -i <video input path> -s 320x240 -vf transpose=1 -r 30 -f ivf - | nc <serveraddr> 8334''


This has various bugs, including:
==External links==
# Return-to-homemenu(which includes power-button handling) does not work, returning to hbmenu is broken too.
* GitHub - https://github.com/yellows8/ctr-streaming-server
# Audio playback starting when the initial connection is closed then another connection opened, is broken. The app does not hang/crash(closing the connection + opening the connection again still works), however no audio is played.
# Ogg handling is broken, this doesn't work very well compared to raw audio playback. Unlike raw audio playback, the app will quickly hang without crashing, when playing ogg audio.
# This app only waits for just one audio chunk(1-second block), then immediately plays that. This results in audio playback briefly stopping while the app waits for the next chunk when playback of the previous chunk already finished.


==Credits:==
[[Category:3DS homebrew applications]]
The yuv2rgb code used by this app is from here: http://wss.co.uk/pinknoise/yuv2rgb/
[[Category:PC utilities for 3DS homebrew]]

Revision as of 11:06, 15 February 2022

CTR Streaming Server
File:CTRStreamingServer-01.jpg
General
Authoryellows8
TypePC Utilities
VersionBeta
LicenseMixed
Last Updated2014/11/21
Links
Source Only Download
Website
Source

This is a 3DS homebrew audio/video playback server, listening on TCP port 8334. This uses ctrulib.

User guide

Compiling: make MEDIAMODE=<val> CODEC=<val> HIDREPORT=<val>

  • MEDIAMODE must be either value 0 for video, or value 1 for audio.
  • CODEC must be either value 0 for raw video/audio, or value 1 for encoded video/audio.
  • HIDREPORT is optional, when the value is non-zero and MEDIAMODE is 0, the server will send a 0x10c-byte block to the client every >= ~1/60 of a second. The first 0x108-bytes are from hidSharedMem+0, the last word is from here. The app will only send the HID block while video data is being received.

Besides ctrulib, the following libraries are required: libvpx, libvorbisfile, libvorbis, and libogg.

  • Configuring libvpx building: CROSS=arm-none-eabi- ./configure --target=generic-gnu "--extra-cflags=-march=armv6 -mtune=mpcore -mfpu=vfp" --disable-multithread --disable-vp8-encoder --disable-vp9-encoder
  • Configuring libogg building: ./configure --host=arm-none-eabi --prefix=/opt/devkitpro/devkitARM/portlibs/arm/armv6

The audio is 44100Hz pcm_s16le mono-channel, when CODEC is non-zero the data sent to the app must be .ogg.

  • When CODEC is non-zero, the video data sent to the app must be VP8 IVF.
  • The color-format of the video frame is the same as the LCD framebuffer, the width must be 240. For raw video, the color-format is RGB565.

The height must be at least 320(sub-screen) or 400(main-screen).

  • For encoded video, larger height values allows more than one LCD framebuffer to be used in each video frame.
  • 320+400 = main-screen image(400 height) + sub-screen image(320 height), 800 = two main-screen images(height 400 for each image), for 3D left and 3D right.
  • 800+320 = same as 800, except this has a 320-height sub-screen image following the main-screen images.

The VP8 video framerate from the client should be only ~20-25fps(this depends on the video dimensions), this is due to single-threaded decoding(higher framerates can't be used due to this not decoding fast enough).

This app handles certain errors by triggering crashes. Note that this includes service initialization failure(such as CSND), like when the app doesn't have access to a required service.

Example terminal commands for streaming to this server:

  • Ogg streaming: avconv -i <inputfile> -f s16le -acodec libvorbis -ac 1 -vn -f ogg - | nc <serveraddr> 8334
  • Raw audio streaming: avconv -i <inputfile> -f s16le -acodec pcm_s16le -ac 1 - | nc <serveraddr> 8334
  • VP8 IVF, for just sub-screen: avconv -i <video input path> -s 320x240 -vf transpose=1 -r 30 -f ivf - | nc <serveraddr> 8334

Known issues

This has various bugs, including:

  • Return-to-homemenu(which includes power-button handling) does not work, returning to hbmenu is broken too.
  • Audio playback starting when the initial connection is closed then another connection opened, is broken. The app does not hang/crash(closing the connection + opening the connection again still works), however no audio is played.
  • Ogg handling is broken, this doesn't work very well compared to raw audio playback. Unlike raw audio playback, the app will quickly hang without crashing, when playing ogg audio.
  • This app only waits for just one audio chunk(1-second block), then immediately plays that. This results in audio playback briefly stopping while the app waits for the next chunk when playback of the previous chunk already finished.

Credits

The yuv2rgb code used by this app is from here.

External links

Advertising: