Categories
Fedora Other

Liquidsoap – MPEGTS Stream into RTP over UDP

I finally have the magical unicorn configuration you’ve been looking for. My previous entry showed you how to create an MPEGTS stream via TCP. Here is the configuration for the MPEGTS stream encapsulated into RTP for UDP. This is a single stream with video and audio, no stupid ass SDP file required. This isn’t suggested for clients to connect and use but as an intermediate transport means. Simple instructions on how to get ffmpeg (ffplay) and VLC to access the streams. You may need to consult satanic priests or launch a car into space as a sacrifice for anything beyond these settings.

Obvious settings are host and port. Your encoding schemes are constrained to what the mpegtsmux capabilities are.

#MPEGTS encapsulated to RTP for UDP Streaming.
#Stream can be played by these players.
#ffplay udp://localhost:5000
#vlc rtp://@:5000
output.gstreamer.audio_video(
video_pipeline=
"videoconvert ! x264enc pass=qual quantizer=20 tune=zerolatency ! video/x-h264,profile=baseline ! queue ! muxer.",
audio_pipeline=
"audioconvert ! fdkaacenc bitrate=128000 ! queue ! muxer.",
pipeline=
"mpegtsmux alignment=7 name=muxer ! rtpmp2tpay ! queue ! udpsink host=127.0.0.1 port=5000 sync=true",
source)

Categories
Fedora Other

Liquidsoap – Gstreamer MPEGTS stream how to

This is a working example using Liquidsoap and it’s Gstreamer output capabilities. You are probably here because there is little to no information on how to configure this other than ambiguous examples with no explanation. I will try to attempt to explain some of the specific configuration options and my experience. First some of the requirements. This article is based on Liquidsoap v1.3.3 and Gstreamer v1.12. You will need several of the plugin packages required for the Gstreamer configuration. I recommend ffmpeg for testing purposes, Gstreamer client commands for testing are beyond painful. This example will require a computer with a CPU with AVX and/or AVX2 extensions. If the CPU does not have these extensions, it is most likely not powerful enough to do the x264 real time encoding. If this is the case you will need to stick with Liquidsoaps built in theora/vorbis video stream at about maximum of 512×376 video dimensions. At the time of this writing, I am not aware of GPU assisted encoding in Gstreamer. You may also need to sacrifice up to four Beef & Bean burritos, unfortunately there is no vegan option at the time of this writing.


#Setup Log Output And Levels For Testing. Once done testing, set to false and 3.
set("log.stdout",true)
set("log.level",10)

#Set Video Frame Width, Height, and Frame Rate. Liquidsoap will resize and if necessary add borders to the videos that are larger or smaller than these dimensions.
#Larger dimensions will increase CPU usage.
#Important: ALL VIDEOS IN SOURCE PLAYLIST MUST BE THE SAME FRAME RATE. If not you will be guaranteed desynchronized audio.
set(“frame.video.width”,720)
set(“frame.video.height”,576)
set(“frame.video.samplerate”,25)
set(“gstreamer.add_borders”, true)

#Playlist of your video files you want to stream.
#Again I reiterate: ALL VIDEOS IN SOURCE PLAYLIST MUST BE THE SAME FRAME RATE. You are going to be doing a lot of re-encoding.
source = playlist(“/home/user/Videos/”)

#The output pipeline you've been dreaming for. You can put the knife down now.
#
#video_pipeline: x264enc is the encoder. The default bitrate is 2048kbits, this setting is in kbits. Higher dimensions will require higher bitrate settings.
# tune=zerolatency is required for this setup. We're in the real time baby!
# pass=qual quantizer=20 are Constant Quality encoding and Quality quantizer. Consult a witch doctor for these settings.
# video/x-h264 defines our video stream mime type. profile=baseline is required. Any other profile you are on your own!
#audio_pipeline: fdkaacenc is the encoder. Other examples show the voaacenc. This is old, use the recommended fdkaacenc instead.
# bitrate setting for fdkaacenc is in bytes.
#pipeline: mpegtsmux is the MPEGTS container used for the video/audio stream.
# tcpserversink is the final destination output. The default for host=/port= are localhost:4953 so are not set in this example.
# recover-policy=keyframe sync-method=latest-keyframe These two settings are required. They set proper keyframes for connecting clients,
# otherwise the clients will never sync up as they will never receive a keyframe.
output.gstreamer.audio_video(
video_pipeline="videoconvert ! x264enc pass=qual quantizer=20 tune=zerolatency ! video/x-h264,profile=baseline ! queue ! muxer.",
audio_pipeline="audioconvert ! fdkaacenc bitrate=128000 ! queue ! muxer.",
pipeline="mpegtsmux name=muxer ! tcpserversink recover-policy=keyframe sync-method=latest-keyframe",
mksafe(source))

First you will want to check your LIQ file for errors and then fire up Liquidsoap, if it didn’t end immediately then that is a good sign. The most likely culprit will be not having one of the Gstreamer plugins, which can be easily installed by your package manager.


$ liquidsoap --check why.liq
$

(This is good, anything else your fumble fingers fucked something up)


2018/05/01 17:06:47 [output(dot)gstreamer:5] GStreamer pipeline: appsrc name="video_src" block=true caps="video/x-raw,format=RGBA,width=720,height=576,framerate=25/1,pixel-aspect-ratio=1/1" format=time blocksize=1658880 ! videoconvert ! x264enc pass=qual quantizer=20 tune=zerolatency ! video/x-h264,profile=baseline ! queue ! muxer. appsrc name="audio_src" block=true caps="audio/x-raw,format=S16LE,layout=interleaved,channels=2,rate=44100" format=time ! audioconvert ! fdkaacenc bitrate=128000 ! queue ! muxer. mpegtsmux name=muxer ! tcpserversink recover-policy=keyframe sync-method=latest-keyframe

Look for this output. Any errors in the Gstreamer configuration will occur at this point and exit Liquidsoap. If everything is good and Liquidsoap is happy it will be streaming to the localhost on port 4953. Now let’s see the video stream!


$ ffplay tcp://localhost:4953
Input #0, mpegts, from 'tcp://localhost:4953':0KB sq= 0B f=0/0
Duration: N/A, start: 3614.480000, bitrate: N/A
Program 1
Stream #0:0[0x41]: Video: h264 (Constrained Baseline) (HDMV / 0x564D4448), yuv420p(tv, bt470bg/smpte170m/bt709, progressive), 720x576 [SAR 1:1 DAR 5:4], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x42](en): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 138 kb/s
3623.20 A-V: -0.030 fd= 3 aq= 22KB vq= 7KB sq= 0B f=0/0

ffplay is part of the ffmpeg package and makes it really easy to test the stream. There should be NO errors. If ffplay is reporting errors the most likely issue is you’ve made changes to the x264enc settings. There is a small margin of error to the conformity of the x264enc settings. The mpegtsmux only supports a handful of video and audio codecs, so be sure to check on what it supports before throwing random encoders at it. It is not recommended that this be used for end clients but as an intermediate type of output. For example, you can use ffmpeg to connect to the stream, transcode and push to an Icecast server.


ffmpeg -re -i tcp://localhost:4953 -f webm -content_type video/webm -c:v libvpx -b:v 1500K -flags:v +global_header -cpu-used 0 -qmin 10 -qmax 42 -deadline realtime -quality realtime -c:a libvorbis -flags:a +global_header icecast://source:yourpassword@localhost:8000/test.webm

Congratulations! You have now entered the foray of alcoholism and drug addiction!

Categories
Cobar Other

Heart Attack and Hard Times

On February 24th, 2017 I went into the ER because I thought I had really bad heart burn and ended up going down right in front of the ER doctor. I had a heart attack.  Chest compression and defibrillator brought me back to life.  Within minutes I was rushed into emergency catheter surgery to unblock my heart.  Spent five nights in the hospital and have been on the road to recovery.

Needless to say the stump digging project has been on hold for the past two months. I will be restarting that project this month and the goal is to have it out by the end of this month. Not sure how realistic that goal is. There’s a lot more to just the stump itself with this project. There’s a buried wire fence that’s a major issue. I’ll figure it out.

Cobar did exceptionally well during my hospital stay. He managed much better than I have ever expected. Especially with the recent separation which hasn’t been all that good for him. He is managing very good but at times he’s still expecting her to show up.  Unfortunately in mid April he injured his right shoulder again which was an issue last year for several months. He’s healing and on track to be better. I now have a better idea of how and what is causing the injury so that I can avoid it in the future.

There wasn’t any pain from the heart attack or surgery itself, but the chest compression and defibrillator was where most of the pain came from. It took a good month and a half for the pain to go away and feel normal. Started back on my exercise routine in April as I couldn’t wait for the cardio rehab which took way too long to start up. I think this ended up being a good thing as the rehab isn’t as much of a chore than it would be if I hadn’t.

This has made my current life a lot more difficult than I had planned for this year. I just am trying to keep positive and continue to move forward.

 

 

Categories
Camping Cobar Other

Poo Grotto Expansion Project #5

This is the announcement of the 2017 Poo Grotto Expansion Project #5. It will be commencing on or about the 1st of March. This will be one of the largest expansion projects and stump removals. There are a total of three stumps to be removed, with the largest one in the photo below. Two smaller ones are behind the large stump. The main stump is substantially rotted. Depending on the amount of rot and how large the root system is it may be a quick removal. The other vegetation may cause delays in removal. There will be plenty of campfire wood for the 2017 camping season. Cobar and I are ready for Super Adventure Fun Time.

Main Stump For Poo Grotto Expansion #5

Categories
Cobar Hemophilia Other

Happy Valentines Day

I haven’t posted much about Cobar for a very long time. He has been by my side almost every day since about 2011.  He is now 9 years old. Much older than I had ever expected him to live. It has been a long emotional roller coaster. One where I am now suffering from Major Depression. He has been doing very good for the past year or so, but for the latter part of 2016 he injured his front right shoulder that took 4 months to heal.  We have now both suffered the loss of our partner in life after she no longer wanted to be in our world and moved out.  She had apathy for him and didn’t even say goodbye.  So I am now responsible for him.

His leg has healed and I am in the process of healing myself and keeping Cobar safe and happy.  I’ve created a new routine of walking him every morning on the weekdays and Saturdays are going to a park day. Which eventually will turn into Saturday Adventure Time when I can afford to drive farther out and go on trail hikes and camping adventures with him.

I will be posting more often on our adventures and what we are doing.

Happy Valentines Day Cobar!

Cobar with his Slobber Owl.

Categories
Cobar Other

Divorced

I lost my best friend of 18 years over the past 4 weeks.

Don’t worry, I kept Cobar. He is doing better than I expected with Beckys absence. It was rough for him in the fall of 2016, but he’s healed and we are walking every day. It’s just him and I now and he is my responsibility and I am his world.

Categories
Other

You Know Facebook Isn’t Real?

It has been about a year now since I closed down my Facebook account. No one noticed or questioned my absence.  Only one user out of about 200 or so ‘Friends’ noticed and questioned what happened after 48 hours of me closing my account.  Only ONE person.  It’s not like I am hard to find or hidden. My own web site domains have been online for 15 years. It’s made me feel like I am a shitty person for making the choice of not participating in the Greatest Social Media Entertainment of all time.  Which isn’t real.

tanktronic sums it up very well in his video.

 

Categories
Fedora

Minetest Fun

I’ve been playing open source block game called Minetest for about a year now. I started up a Minetest Server in about May of this year with the name Stupid Town Tree.  Online games, the retched hive of scum and villainy.

Minetest Smiley Face

Categories
Camping Karvanek Conspiracy

A Note For Future Campers

A friend and I went camping and he found a jacket hanging in a tree in one of the campsites. Inside it was this note and beer.

The Joy Of Camping

A Note To Future Campers
A Note To Future Campers

Categories
Dogs Other

Poo Grotto Expansion Project #4

Announcing the beginning of the Poo Grotto Expansion Project #4 for the month of April. Prime fence barking, private poo area and access to back area will be hindered during this partial deck removal and stump removal.

Before project start.
Day one of  project.

Day two of project.
Day two of project.