Before continuing, follow the Install and Run Guide for SDL Core if you have not already done so.
The Generic HMI and SDL HMI both support streaming audio and some video formats in the browser using ffmpeg to transcode the video to VP8 WEBM or audio to WAV. Instructions to install the required dependencies can be found in the HMI README:
Prior to starting the HMI, you will need to run the backend server component (./deploy_server.sh
in the HMI directory) which handles the transcoding process.
Once you start a video stream it will take a few seconds for the transcoding session to begin. Your video stream should appear in the browser within about 10 seconds.
To stream without ffmpeg transcoding, or to stream a format that ffmpeg does not support, you can forgo starting the backend server and use gstreamer to consume your audio/video stream.
It is easier to determine which gstreamer video sink will work in your environment by testing with a static file. This can be done by downloading this file and trying the following command.
Common values for sink:
Copied to clipboard!
gst-launch-1.0 filesrc location=/path/to/h264/file ! decodebin ! videoconvert ! <sink> sync=false
If you're streaming video over TCP, you can point gstreamer directly to your phone's stream using
Copied to clipboard!
gst-launch-1.0 tcpclientsrc host=<Device IP Address> port=3000 ! decodebin ! videoconvert ! <sink> sync=false
In the Core build folder, open bin/smartDeviceLink.ini
and ensure the following values are set:
Copied to clipboard!
VideoStreamConsumer = pipe AudioStreamConsumer = pipe
After you start SDL Core, cd into the bin/storage directory and there should be a file named "video_stream_pipe". Use the gst-launch command that worked for your environment and set file source to the video_stream_pipe file. You should see “setting pipeline to PAUSED” and “Pipeline is PREROLLING”.
Copied to clipboard!
gst-launch-1.0 filesrc location=$SDL_BUILD_PATH/bin/storage/video_stream_pipe ! decodebin ! videoconvert ! xvimagesink sync=false
Copied to clipboard!
gst-launch-1.0 filesrc location=$SDL_BUILD_PATH/bin/storage/video_stream_pipe ! "application/x-rtp-stream" ! rtpstreamdepay ! "application/x-rtp,media=(string)video,clock-rate=90000,encoding-name=(string)H264" ! rtph264depay ! "video/x-h264, stream-format=(string)avc, alignment=(string)au" ! avdec_h264 ! videoconvert ! ximagesink sync=false
Copied to clipboard!
gst-launch-1.0 filesrc location=$SDL_BUILD_PATH/bin/storage/audio_stream_pipe ! audio/x-raw,format=S16LE,rate=16000,channels=1 ! pulsesink
In the Core build folder, open bin/smartDeviceLink.ini
and ensure the following values are set:
Copied to clipboard!
; Socket ports for video and audio streaming VideoStreamingPort = 5050 AudioStreamingPort = 5080 ... VideoStreamConsumer = socket AudioStreamConsumer = socket
Copied to clipboard!
gst-launch-1.0 souphttpsrc location=http://127.0.0.1:5050 ! decodebin ! videoconvert ! xvimagesink sync=false
Copied to clipboard!
gst-launch-1.0 souphttpsrc location=http://127.0.0.1:5050 ! "application/x-rtp-stream" ! rtpstreamdepay ! "application/x-rtp,media=(string)video,clock-rate=90000,encoding-name=(string)H264" ! rtph264depay ! "video/x-h264, stream-format=(string)avc, alignment=(string)au" ! avdec_h264 ! videoconvert ! ximagesink sync=false
Copied to clipboard!
gst-launch-1.0 souphttpsrc location=http://127.0.0.1:5080 ! audio/x-raw,format=S16LE,rate=16000,channels=1 ! pulsesink
This section describes how Core manages the streaming states of mobile applications. Only one application may stream video at a time, but audio applications may stream while in the LIMITED state with other applications.
When an app is moved to HMI level FULL
:
BACKGROUND
BACKGROUND
FULL
go to LIMITED
When an app is moved to HMI level LIMITED
:
BACKGROUND