[FFmpeg-user] Raspivid with ffmpeg on both sources (youtube & rtsp)

Nicolas Winandy nix042eb at hotmail.com
Mon Jun 19 23:17:34 EEST 2017


Good evening all,
I am now playing with raspivid on Raspbian and a raspberry pi equipped with a PinoIR camera module.

I am almost done with the setup and have found a pre-compiled version of FFmpeg 3.1.1 to experiment a streaming to a youtube live stream by means of the command:

raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>
Is there any parameter I can use to also stream to a local machine (e.g. through a VLC client reading the stream) ?

I have achieved to do it in another bash with cvlc:

[code]cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}':demux=h264[/code]
but executing both bashes at the same time is not possible as the input camera is locked by the system.

So, I looked in the ffmpeg documentation and found an interesting thread on multiple outputs : https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs.
Then, I have tried the piped processes and another ffmpeg call to the inital command:

raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION> | ffmpeg -f h264 -i - -vcodec copy -f rtsp -rtsp_transport tcp rtsp://localhost:8888/live.sdp

It appears to have a syntax error, and maybe it is not the best way of achieving this. Could you please put me on the right track ?

Thanks and have a nice night !

Nicolas



More information about the ffmpeg-user mailing list