Streaming with ffmpeg?

Area for discussing streaming over the Internet, especially as it relates to ATV
Forum rules
This forum is run by the BATC (British Amateur Television Club), it is service made freely available to all interested parties, please do not abuse this privilege.

Thank you
M0DTS
Posts: 391
Joined: Sun Feb 24, 2008 9:03 pm

Streaming with ffmpeg?

Post by M0DTS » Wed Sep 12, 2012 12:38 pm

Hi All..

Has anyone tried streaming to batc with ffmpeg or have any ideas how to do it?
It appears to function but no stream seen on batc as if i have missed some commands like the extra stream name in Adobe media encoder..

example command line which appears to connect but no video shows on the batc stream...
ffmpeg -i test.avi -acodec libmp3lame -vcodec libx264 -b 300k -vf scale=iw/2:-1 -f flv "rtmp://fms.***********************/streamname"

I would like to change my streaming pc to linux to do more things with the RTL2832 dongle for beacon monitoring etc but need streaming capability to make this possible.

Any ideas appreciated!

Rob
M0DTS

G0MXW
Posts: 20
Joined: Thu Sep 29, 2011 4:59 pm

Re: Streaming with ffmpeg?

Post by G0MXW » Wed Sep 19, 2012 11:53 am

Rob,

You are spot on about the extra stream name in Adobe encoder.
For ffmpeg append the Stream name to the FMS URL

"rtmp://fms.XXXX.XX/XXXX/XXXXX/<stream name>"

Rest of your ffmpeg command line is ok. You may have to pig around with block size and fps settings but will get you going.

Trying same thing here with RTL dongle but struggling with dropped frames at the moment, prob due to under powered Linux box and ffmpeg not coping with non constant bit rate stream I'm trying to sort out.

Dave
G0MXW

M0DTS
Posts: 391
Joined: Sun Feb 24, 2008 9:03 pm

Re: Streaming with ffmpeg?

Post by M0DTS » Wed Sep 19, 2012 10:26 pm

AHA!

Thanks Dave, that must have been the only combination of things i have not tried...hi

Playback from a file is fine, will now try get live stream to work.

Cheers,

Rob
M0DTS

G6GIF
Posts: 2
Joined: Mon Oct 08, 2012 12:22 pm

Re: Streaming with ffmpeg?

Post by G6GIF » Mon Oct 08, 2012 7:34 pm

Hi

I've had good luck streaming with FFMPEG and I was going to do a write up for Chris then decided to wait for the latest update to http://www.ws4gl.org as it was the commands published here that gave me clues, Patrick has been busy but I can confirm that Webcamstudio 0.57b4 will stream to BATC.tv but the JVM is quite processor intensive so if you just need the streaming with no mixing or effects you are better off just using FFMPEG from the CLI.

Make sure you have a very recent build of FFMPEG the unstripped version from Medibuntu works fine if you are Ubuntu based or an equivalent for your distro then adjust your settings to suit, once I got it figured out it worked without problems but I haven't tried VBR.

Code: Select all

ffmpeg -f video4linux2  -i /dev/video1 -f alsa -i pulse -acodec libmp3lame -ac 1 -ab 64kb -ar 22050 -f flv -s 480x360 -r 15 -b 256kb "rtmp://fms.batc.tv/live/************/********** flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)"
I think you know about the Docs at http://www.ffmpeg.org

I hope this helps good luck Mike G6GIF/KD5PEX

G6GIF
Posts: 2
Joined: Mon Oct 08, 2012 12:22 pm

Re: Streaming with ffmpeg?

Post by G6GIF » Thu Oct 18, 2012 9:13 am

I'd like to correct myself on the subject of FFMPEG and lib3lame versions, I'm using FFMPEG from Jon Severinssons PPA https://launchpad.net/~jon-severinsson/+archive/ffmpeg and I'm using libmp3lame 3.99.3+repack1-1 from the ubuntu dev team.

I can confirm these are working in Ubuntu 12.04 for streaming to BATC.tv using the command string in my previous post, sometimes its a problem remembering what is installed in each computer in the shack ( actually all the time when you get to my age :D )

M0DTS
Posts: 391
Joined: Sun Feb 24, 2008 9:03 pm

Re: Streaming with ffmpeg?

Post by M0DTS » Fri Oct 19, 2012 7:15 pm

Thanks for the info,

GB3KM stream from my qth is now being sent with ffmpeg and similar settings to above using PVR-USB2 capture device as used on the Digilite.

I did have trouble with encoding when we dropped carrier and the encoder just saw noise, it did not like it and upped the stream bit-rate considerabley causing stuttering with my 1024kbps uplink! The fix for this was to use: -maxrate and -bufsize settings to limit the output bandwidth of the stream when trying to encode noise - basically CBR.

I just have to fix the lack of chroma sensitivity on the PVR-USB2 now to get some colour back on the stream!

Rob
M0DTS

vk4ea
Posts: 4
Joined: Sun Sep 02, 2018 3:19 am

Re: Streaming with ffmpeg?

Post by vk4ea » Sun Sep 02, 2018 3:41 am

Gidday from VK land,

I am struggling to get ffmpeg streaming to the BATC streamer.

I have got the Hauppage Live 2 working nicely with ffplay, so presumably there is no driver issues and all v4l2 utils and associated libraries are up to date. System is Ubuntu 17.04.

Command I am using is

Code: Select all

 ffmpeg -f video4linux2  -i /dev/video4 -f alsa -i hw:4 -acodec libmp3lame -ac 1 -ab 64kb -ar 22050 -f flv -s 480x360 -r 15 -b:v 256kb "rtmp://rtmp.batc.org.uk/live/streamname-crsmwm"  
Hauppage video is /dev/video4, sound is hw:4

Error is ->

Code: Select all

rtmp://rtmp.batc.org.uk/live/streamname-crsmwm: Input/output error
Thanks in advance.
Cheers,
Peter - VK4EA

G8GKQ
Site Admin
Posts: 1287
Joined: Sun Mar 22, 2009 1:21 pm

Re: Streaming with ffmpeg?

Post by G8GKQ » Sun Sep 02, 2018 10:08 am

Hi Peter

If I understand your quoting correctly, the problem is that "streamname" should be "vk4ea"

Dave

vk4ea
Posts: 4
Joined: Sun Sep 02, 2018 3:19 am

Re: Streaming with ffmpeg?

Post by vk4ea » Sun Sep 02, 2018 8:15 pm

Hi Dave,

Changed the stream name as suggested, same result.
Cheers,
Peter - VK4EA

G8GKQ
Site Admin
Posts: 1287
Joined: Sun Mar 22, 2009 1:21 pm

Re: Streaming with ffmpeg?

Post by G8GKQ » Sun Sep 02, 2018 9:52 pm

Hi Peter

The code that the Portsdown uses (with variables to define the parameters) is:

Code: Select all

$PATHRPI"/ffmpeg" -loglevel $MODE_DEBUG -thread_queue_size 2048\
  -f v4l2 -video_size "$VIDEO_WIDTH"x"$VIDEO_HEIGHT" \
  -i $VID_USB \
  -f alsa -ac $AUDIO_CHANNELS -ar $AUDIO_SAMPLE \
  -i hw:$AUDIO_CARD_NUMBER,0 \
  -framerate 25 -c:v h264_omx -b:v 512k \
  -ar 22050 -ac $AUDIO_CHANNELS -ab 64k \
  -vf "$CAPTION""$SCALE"yadif=0:1:0 -g 25 \
  -f flv $STREAM_URL/$STREAM_KEY
The obvious difference that I can see is that the ffmpeg command is in a different order (which does matter) and that the URL is not in quotes. The order that seems to work is to define the video input and format, define the audio input and format, define the video encoding, define the audio encoding, add any video filters, then define the output encapsulation and destination.

Hope that helps

Dave

Post Reply

Return to “Streaming”