12

I hope to stream my video camera and audio mic. using ffserver.

ffserver says it could do such, but I just can't find any working source?

If someone knows, could you please show me how it's done?

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
Potato
  • 181
  • 1
  • 2
  • 13

2 Answers2

17

Please refer to following links:


Following is configuration of my test env:

ffserver configuration [/etc/ffserver.conf]

HttpPort 8090 
RtspPort 5554
HttpBindAddress 0.0.0.0 
MaxClients 1000 
MaxBandwidth 10000 
NoDaemon 

<Feed feed1.ffm> 
File /tmp/feed1.ffm 
FileMaxSize 5M 
</Feed> 

<Stream test.mpeg4>
Feed feed1.ffm
Format rtp
VideoCodec mpeg4
VideoFrameRate 15
VideoBufferSize 80000
VideoBitRate 100
VideoQMin 1
VideoQMax 5
VideoSize 352x288
PreRoll 0
Noaudio
</Stream>

Run ffserver like following:

ffserver -d

Start video capture from web camera:

ffmpeg -r 25 -s 352x288 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm

Now you can play your stream using any rtsp client. In my example I use ffplay:

ffplay "rtsp://localhost:5554/test.mpeg4

I just tested this configuration on my laptop. And it works fine!

Igor Chubin
  • 61,765
  • 13
  • 122
  • 144
Murad Tagirov
  • 776
  • 6
  • 10
  • Thank you for answering me. It would be look idiot, I don't know well. But, that's http, not rtsp. I hope to see case of useing rtsp port. – Potato May 24 '16 at 11:57
  • It works! You feed to http and contact to rtsp for playing. I thought it should be fed to rtsp. Thank you so much. – Potato May 25 '16 at 11:44
  • I'm sorry to bother you. But,, did't you test with audio? – Potato May 25 '16 at 12:03
  • You have to add audio codec parameters to ffserver configuration file. And add input to ffmpeg (-f alsa -i pulse). Should work! – Murad Tagirov May 25 '16 at 13:28
  • 1
    I'm trying like this "AudioCodec aac \ AudioBitRate 32 \ AudioSampleRate 44100 \ AVOptionAudio flags +global_header" changing codecs and option but it doesn't work.. – Potato May 26 '16 at 09:58
2

I also try this for video and audio but neither the video nor the sound could be established.

HttpPort 8090 
RtspPort 8554
HttpBindAddress 0.0.0.0 
MaxClients 1000 
MaxBandwidth 10000 
NoDefaults

<Feed feed1.ffm> 
    File /tmp/feed1.ffm 
    FileMaxSize 5M
    ACL allow 127.0.0.1
</Feed> 

<Stream test>
    Feed feed1.ffm
    Format rtp

    #VideoCodec libx264
    #VideoFrameRate 25
    #VideoBufferSize 80000
    VideoBitRate 4000
    VideoSize 1920x1080

    AudioCodec aac
    Strict -2
    AudioBitRate 8000
    AudioChannels 2
    AudioSampleRate 44100
    AVOptionAudio flags +global_header

</Stream>

But by adding the "Noaudio", only the video is playing. How to fix the problem؟

Javad Sadi
  • 518
  • 4
  • 6