More actions
No edit summary |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Infobox 3DS Homebrews | {{Infobox 3DS Homebrews | ||
|title=CTR Streaming Server | |title=CTR Streaming Server | ||
|image= | |image=3dspc.png | ||
|description=3DS homebrew network server for playing media sent to it from other network devices, and HID reporting over the network. Build from repo. | |description=3DS homebrew network server for playing media sent to it from other network devices, and HID reporting over the network. Build from repo. | ||
|author=yellows8 | |author=yellows8 | ||
|lastupdated=2014/11/21 | |lastupdated=2014/11/21 | ||
|type= | |type=3DS Streaming | ||
|version=Beta | |version=Beta | ||
|license=Mixed | |license=Mixed | ||
|download=https://dlhb.gamebrew.org/ | |download=https://dlhb.gamebrew.org/3dshomebrews/ctr_streaming_server.zip 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 | ||
}} | }} | ||
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: | ==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. | |||
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. | |||
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. | Audio and color format: | ||
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 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. | Screen image size: | ||
* 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). | ||
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> | |||
'''Note:''' This app handles certain errors by triggering crashes. This includes service initialization failure (such as CSND), like when the app doesn't have access to a required service. | |||
==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 [http://wss.co.uk/pinknoise/yuv2rgb/ here]. | |||
== | ==External links== | ||
* GitHub - https://github.com/yellows8/ctr-streaming-server |
Latest revision as of 11:08, 22 Haziran 2024
CTR Streaming Server | |
---|---|
General | |
Author | yellows8 |
Type | 3DS Streaming |
Version | Beta |
License | Mixed |
Last Updated | 2014/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
Audio and color format:
- 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.
Screen image size:
- 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).
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
Note: This app handles certain errors by triggering crashes. This includes service initialization failure (such as CSND), like when the app doesn't have access to a required service.
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.