You are not logged in.

#1 2014-10-02 12:59:32

smirky
Member
From: Bulgaria
Registered: 2013-02-23
Posts: 277
Website

ffserver & ffmpeg & udp - looking for a tip

I managed to learn little about streaming with ffserver, but the more I find, the more I feel like a drop in the ocean. The thing is, I wanted to squeeze the best quality that can go through my upload bandwidth which is 500 KB/s. I'm facing some errors and it's probably because of bad configuration. Also after a while (seconds, minute maximum) I start to get latency on the client side. Here's my configuration:

 $ ffserver -f ffserver.conf
# ffserver.conf
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxClients 10
MaxBandwidth 40000

<Feed feed1.ffm>
   File /tmp/feed1.ffm
   FileMaxSize 40M
   ACL allow localhost
   ACL allow 192.168.0.0 192.168.255.255
   ACL allow 10.8.13.202 10.8.13.255
</Feed>

<Stream live.ts>
   Format  mpegts
   Feed   feed1.ffm
   VideoCodec libx264
   VideoFrameRate 24
   VideoSize 1920x1088
   VideoBitRate 1000K
#   
   VideoGopSize 12
   VideoHighQuality
   Video4MotionVector
#   AVOptionVideo threads 4
   NoAudio
#   VideoSize 1024x672
#   NoAudio
</Stream>
 $ ffmpeg -f x11grab -s 1920x1080 -r 24 -i :0.0 -c:v libx264 -preset ultrafast -s 1920x1080 -threads 4 -f mpegts udp://localhost:1234
 $ ffmpeg -i udp://localhost:1234 -vcodec copy http://127.0.0.1:8090/feed1.ffm

I'm wondering if I have any messed up or missing settings to get it done right.
In the ffserver.conf, I've set the resolution to 1920x1088 because of the "divide by 16" requirement (hope that's not a problem).

Last edited by smirky (2014-10-02 12:59:51)


Personal spot  ::  https://www.smirky.net/  ::  Try not to get lost!

Offline

#2 2014-10-02 18:06:35

DrZaius
Member
Registered: 2008-01-02
Posts: 193

Re: ffserver & ffmpeg & udp - looking for a tip

smirky wrote:

I managed to learn little about streaming with ffserver, but the more I find, the more I feel like a drop in the ocean.

Some good places to start I think:

Note that FFserver is currently only marginally maintained and that it will mostly be up to you to figure things out.

smirky wrote:

The thing is, I wanted to squeeze the best quality that can go through my upload bandwidth which is 500 KB/s.

Sounds like you should use VBV by using -maxrate and -bufsize. In your case maybe 500 * 0.85 = -maxrate 425k, and -bufsize somewhere between 1-5 seconds, being somewhere between 425k to 2125k in your case.

smirky wrote:

I'm facing some errors and it's probably because of bad configuration.

What are the errors?

smirky wrote:
 $ ffmpeg -f x11grab -s 1920x1080 -r 24 -i :0.0 -c:v libx264 -preset ultrafast -s 1920x1080 -threads 4 -f mpegts udp://localhost:1234
 $ ffmpeg -i udp://localhost:1234 -vcodec copy http://127.0.0.1:8090/feed1.ffm

You should show the complete console output for each of these commands.

smirky wrote:

In the ffserver.conf, I've set the resolution to 1920x1088 because of the "divide by 16" requirement (hope that's not a problem).

You need mod2 for width and height when using x264 when outputting to 4:2:0 chroma subsampling. I am not aware of any "divide by 16 requirement". The requirements change with other chroma subsampling schemes, but I can't tell what you are using since your command outputs are missing.

Last edited by DrZaius (2014-10-02 18:12:50)

Offline

#3 2014-10-02 19:06:09

smirky
Member
From: Bulgaria
Registered: 2013-02-23
Posts: 277
Website

Re: ffserver & ffmpeg & udp - looking for a tip

Here I've provided stderr + stdout dumps of ffserver and ffmpeg.

https://www.smirky.net/ffserver/

1 - ffserver with 1920x1080 set in ffserver.conf (ffserver.conf:19: Image size must be a multiple of 16). That's why I rounded it to 1088.
2 - ffmpeg (the x11grab to udp dump). Everything looks good there I think.
3 - ffmpeg (the feed dump). Here I get loads of errors and it doesn't get started at the first couple of times. On the ~[third/fourth] time it gets going.

I hope these logs are sufficient.

Last edited by smirky (2014-10-02 19:11:13)


Personal spot  ::  https://www.smirky.net/  ::  Try not to get lost!

Offline

Board footer

Powered by FluxBB