Author Topic: Use of webcam  (Read 78167 times)

Remy

  • Hero Member
  • *****
  • Posts: 645
  • Karma: +9/-1
    • View Profile
Re: Use of webcam
« Reply #165 on: July 26, 2020, 11:27:50 pm »
It seems the target is achieved    :D

Now, developpers can record warpstock présentations for they own use !
or any presentation needed to be shared for education etc...

Regards
Rémy

onlineuser2

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Use of webcam
« Reply #166 on: July 26, 2020, 11:56:29 pm »
Wooowww!!!!!!!!!

ivan

  • Hero Member
  • *****
  • Posts: 1558
  • Karma: +17/-0
    • View Profile
Re: Use of webcam
« Reply #167 on: July 27, 2020, 12:03:48 am »
I would like to thank Wim and Remy for their work on this.

Now all it needs is some bright programmer to either put together a zip file containing everything necessary to run video streaming or explain in simple language what we need to do.  That way I might be able to do video conferencing without having to fire up Zoom on one of my Linux boxes.

 

Remy

  • Hero Member
  • *****
  • Posts: 645
  • Karma: +9/-1
    • View Profile
Re: Use of webcam
« Reply #168 on: July 27, 2020, 02:50:52 am »
I would like to thank Wim and Remy for their work on this.

Now all it needs is some bright programmer to either put together a zip file containing everything necessary to run video streaming or explain in simple language what we need to do.  That way I might be able to do video conferencing without having to fire up Zoom on one of my Linux boxes.

 

You already can give it some try changing ffmpeg output to an url. On the other side, use ffplay to show the video (use ffplay nobuffer and other tips to reduce latency)

First give a try to check hw the video is. May be you'll nee to adjust framerate according what is send by your webcam. Start using 25 and if the video is like an accelerated video, reduce it to 15.

ffmpeg -async 1 -framerate 15 -itsoffset 2.0 -f mjpeg -i \PIPE\Webcam\Video -thread_queue_size 96 -i \PIPE\Webcam\Audio -q:v 3 -b:a 192k zmovie.avi

Once the video is nice, then replace it by an url which could be udp ( udp://your pc ip@:2000 ) or of other supported type. On the other side, use ffplay to read the stream or other compatible player.

Not tested (itsoffset may be adjusted etc... if only voice has to be recorded, than 22050 should be enough and may reduce kbps sent as well reducing video quality to 5 give a correct video but with less kbps):
e.g.  ffmpeg -async 1 -framerate 15 -itsoffset 1.0 -f mjpeg -i \PIPE\Webcam\Video -i \PIPE\Webcam\Audio -q:v 5 -b:a 128k -ar 22050 -tune zerolatency -f mpegts udp://yourserver-ip@:2000

e.g.  ffplay -fflags nobuffer -probesize 64 -analyzeduration 1 -f mpegts -i udp://yourserver-ip@:2000 -volume 60  (use headphone if on the same pc in which case yourserver-ip@ could be 127.0.0.1)

If you go through an internet box, do not forget to customize the NAT (network address translation "table" to route incoming traffic on port 2000 (in this example) to your pc @ip at port 2000 for udp traffic

To allow many  end users(2 or more)  to watch the live stream, start ffserver after configuring the ffserver.conf file (provided conf sample provides useful information)   

internet box NAT example (warning, not secured)
just as illustration
(good information can be found here: https://trac.ffmpeg.org/wiki/StreamingGuide#Pointtopointstreaming )

 
 
 
« Last Edit: July 27, 2020, 03:23:32 pm by Remy »

Remy

  • Hero Member
  • *****
  • Posts: 645
  • Karma: +9/-1
    • View Profile
Re: Use of webcam
« Reply #169 on: July 27, 2020, 05:16:09 pm »
If mp4 is a prefered recorded video, don't use the line command used for avi or mpegts (it seems that replacing avi or mpegts by mp4 provides out of sync)
To prevent this, following line command works well:
ffmpeg -async 1 -framerate 25 -itsoffset 2 -f mjpeg -framerate 25 -i \PIPE\Webcam\Video -i \PIPE\Webcam\Audio -q:v 3 -q:a 1 -f avi - |ffmpeg -y -i - mymp4.mp4

Remy

  • Hero Member
  • *****
  • Posts: 645
  • Karma: +9/-1
    • View Profile
Re: Use of webcam
« Reply #170 on: July 30, 2020, 04:44:44 pm »
Suggestion:

About live streaming, maybe something like this could work !
I could get the flv file and a test to rtmp doesn't provide errors except no key to be allowed   
(Those having an account could do a test and report feedback please)

With a twich account:
ffmpeg -y -async 1 -framerate 25 -itsoffset 2.5 -f mjpeg -framerate 25 -i \PIPE\Webcam\Video -i \PIPE\Webcam\Audio -c:v libx264 -preset veryfast -b:v 2500k -maxrate 2500k -bufsize 5000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 1 -
ar 44100 -tune zerolatency -f flv rtmp://live.twitch.tv/app/<stream key>

Or for vimeo rtmp://rtmpin.livestreamingest.com/rtmpin/<stream key> after having added/corrected output video size, video bitrate, audio bitrate etc...

Note: ffserver is no more supported (but may work)