HLS Live streaming

Hi Guys,

I wish to live stream camera feed on ios app. I have found the following command for running the streaming server. The command is the following :

gst-launch-1.0 videotestsrc is-live=true ! x264enc ! mpegtsmux ! hlssink max-files=5

However, I am unable to find the existing threads to figure out how the URL needs to be formed on client side.

Currently I am forming the URL as suggested in https://devtalk.nvidia.com/default/topic/992525/jetson-tx1/no-video-for-hls-on-ios/1

http://192.168.1.36:8000/playlist.m3u8

but it doesn’t seem to work. I have replaced the IP with the IP of server.

Please help me out. Please let me know how to form the URL.

Thanks

Please check
1 If x264enc outputs h264 stream wit AU delimiter
2 Run ‘python -m SimpleHTTPServer’ on TX1
3 Open http://192.168.1.36:8000/playlist.m3u8 on iOS Safari

The URL looks good. The issue should be lack of AU demiliter, or HTTP server is not running.

Hi DaneLLL,

Thanks for your response. Just to be clear I am experimenting using TX2. When I run the command, I get the following dumps:

  1. playlist.m3u8
  2. segment%04d.ts files
  3. wAUD.h264

By “If x264enc outputs h264 stream wit AU delimiter” do you mean #3 ?

My final objective is to stream live camera feed.

I am able to get the command to work by running server. I think that was the issue. However, I am not sure how to stream live feed from camera. Could you please help me with the gstreamer commandline?

I replaced videotestsrc by nvcamerasrc as follows:

gst-launch-1.0 nvcamerasrc sensor-id=0 ! x264enc ! mpegtsmux ! hlssink max-files=5

However, I am getting the following error :

WARNING: erroneous pipeline: could not link nvcamerasrc0 to x264enc0

Please let me know how to proceed.

Thanks

Hi,
x264enc is SW encoder in gstreamer:
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-ugly-plugins/html/gst-plugins-ugly-plugins-x264enc.html
It enables AU demiliter by default.

We verify below steps on r28.2.1/TX2 and it works:

// generate video files and playlist
$ gst-launch-1.0 videotestsrc num-buffers=300 ! 'video/x-raw,width=1280,height=720' ! x264enc ! mpegtsmux ! hlssink
// You should see
-rw-rw-r--  1 nvidia nvidia     155 Sep 28 08:28 playlist.m3u8
// and
-rw-rw-r--  1 nvidia nvidia 2738032 Sep 28 08:28 segment00000.ts

// run http server
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

// Open link on iPhone 6 Safari
http://<TX2_IP_ADDR>:8000/playlist.m3u8

Hi DaneLLL,

Thanks for your response. This seems to work. How should I use the same for ‘nvcamerasrc’ instead of videotestsrc ?

Thanks.

Please refer to user guide and set insert-aud to true.
https://developer.nvidia.com/embedded/dlc/l4t-accelerated-gstreamer-guide-28-2-ga

Hi DaneLLL,

Thanks for the help. I tried the following command:

gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" sensor-id=0 ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)30/1' ! omxh264enc bitrate=1000000 insert-aud=true ! video/x-h264, profile=baseline  ! hlssink max-files=5

I get the following output on terminal running SimpleHTTPServer:

Serving HTTP on 0.0.0.0 port 8000 ...
10.33.55.11 - - [01/Oct/2018 05:19:25] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:19:25] "GET /segment00000.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:19:40] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:19:40] "GET /segment00001.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:19:56] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:19:56] "GET /segment00002.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:20:11] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:20:11] "GET /segment00003.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:20:26] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:20:26] "GET /segment00004.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:20:41] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:20:41] "GET /segment00005.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:20:56] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:20:56] "GET /segment00006.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:21:12] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:21:12] "GET /segment00007.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:21:27] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:21:27] "GET /segment00008.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:21:42] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:21:42] "GET /segment00009.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:21:57] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:21:57] "GET /segment00010.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:22:12] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:22:12] "GET /segment00011.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:22:27] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:22:27] "GET /segment00012.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:22:42] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:22:42] "GET /segment00013.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:22:58] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:22:58] "GET /segment00014.ts HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:23:13] "GET /playlist.m3u8 HTTP/1.1" 200 -
10.33.55.11 - - [01/Oct/2018 05:23:13] "GET /segment00015.ts HTTP/1.1" 200 -

However, I am unable to see the stream on 10.33.55.11 machine. I am using VLC media player to receive the stream on 10.33.55.11 machine. I am also unable to find wAUD.h264 file being dumped.

Please let me know where I am going wrong.

Thanks.

Looks like mpegtsmux is absent.

Hi DaneLLL,

Thanks a lot for the help. It works.