Closed innat closed 2 years ago
@innat-2k14 It didn't come pre-installed on my Raspbian OS -- have you already installed it? Unfortunately I didn't take notes on how I installed ffmpeg. It's one of those things that, once you set it up, you never have to mess with it again. So I didn't take good notes at the time.
Thanks , it solved anyway 👍
Did you face any storage problem ? I'm using 16GB though i'm running out of storage .
@innat-2k14 Yeah, I ran into storage issues almost immediately, so I bought a 100 GB micro storage card for $20. It's tiny, barely the size of a fingernail. That was a year and half ago, and now that I look on Amazon I can see that there are 256 GB cards for only $25! Storage has gotten way cheaper over time.
Hello @RyanZotti , took a short pause for academic exam. However, yesterday i tried to move on with video streaming process with ffmpeg
and my /etc/ffserver.conf
file content look like below. Now , When i click webcam.mjpeg
in the available status tab in status.html
, page just keeps loading. Shouldn't i get GUI on the streaming video or what should be the further output in this point :confused:
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 10
MaxBandwidth 50000
AudioSampleRate 44100
VideoBitRate 64
VideoBufferSize 40
VideoFrameRate 3
VideoSize 160x128
VideoGopSize 12
<Feed webcam.ffm>
File /tmp/webcam.ffm
FileMaxSize 10M
</Feed>
<Stream webcam.mjpeg>
Feed webcam.ffm
Format mpjpeg
VideoFrameRate 10
VideoIntraOnly
VideoBitRate 20000
VideoBufferSize 250
VideoSize 320x240
VideoQMin 1
VideoQMax 10
NoAudio
Strict -1
</Stream>
Now , i followed this blog tutorials installing FFMPEG for Raspberry Pi and i guided to me to include support for H264 video before installing ffmpeg
if i wish to and similar case to other necessary libraries or format. All i have to do this before installing ffmpeg
.
Did you install any extra packages or import any necessary libraries.So , in this point what should be the output and if streaming is already ongoing at the time when i clicked on webcam.mjpeg
link in statust.html
file ( though web page just keep loading ) , where my video files are saving.
I decided to take some up and running with ffmpeg
tools and so i installed it on my PC but not in Raspberry Pi right now :smile:
You mentioned that after running following code _
sudo ffserver -f /etc/ff.conf_original & ffmpeg -v quiet -r 5 -s 320x240 -f video4linux2 -i /dev/video0 http://localhost/webcam.ffm
video should be available at this URL http://192.168.0.35/webcam.mjpeg
, you also mentioned that , browser will endlessly download the streaming file. So , what is the default location to save streaming file. Again while you ran python save_streaming_video_data.py --ip 192.168.1.82
, in this point i get little confuse, which one is your IP address you used - 192.168.0.35
or 192.168.1.82
. I think you probably have dynamic IP address or you just working on both your laptop and Raspberry Pi in terminal.
Technically the home page of ffserver
when i past and go the following URL on browser. Oh, i should remember you that , for up and running purpose with ffserver
, i installed and testing it on my PC but right now not in Pi.
http://[PC_IP_ADDRESS]:8090/stat.html
and
http://[PC_IP_ADDRESS]:8090/webcam.mjpeg
or run use
<video width="320" height="240" autoplay>
<source src="[PC_IP_ADDRESS]:8090/webcam.mjpeg" type="video/webm">
</video>
@innat-2k14 Unfortunately I didn't document any of my ffmpeg work, so I don't recall if I had to install other libraries. It's one of those things that's extremely painful to install successfully the first time, but the when you get it working once you never have to touch it ever again. If I ever have to reinstall ffmpeg (e.g., on a different Pi or for a different car) I'll make sure to document it better.
I've never been able to download the file from my browser and that's likely because it's a streaming rather than static file. Instead, I save the file through the save_streaming_video_data.py
script. The exact IP address will almost always be different for different people. You should use whatever IP is assigned to your Pi/PC at the time that you run the ffmpeg command. The exact IP could change day to day. Here you can see that I have parameterized the IP. So you run the script like so: python save_streaming_video_data.py --ip 1.2.3.4
where 1.2.3.4
is your IP. If you don't know your IP you can find it from the command line, like so: hostname -I
.
Also, the script will save the mov file according to what you have here. In this case, it saves it to the current working directory under a file called output.mov
, but you can save and name the file whatever you would like.
Hope that helps.
Hello, I'm following this repository for building self driving car. Do I need to clone this repository on 2 devices that is Raspberry pi and my laptop?. I have install ffmpeg on my Raspberry. What is the next step that I need to do on my Raspberry pi? Also what I need to do on my Laptop? I'm not sure what script to run on what devices and where to check for the output? Could you please guide me.
@yashtrivedi96 yes you need to clone the repo on both devices.
After installing ffmpeg you have to setup an ffserver.conf file to stream in mjpeg format. the file is usually located in\home\etc
however i saved a copy into /usr/src/ffmpeg
and used that
Below is the config that Ryan used.
HTTPPort 80
HTTPBindAddress 0.0.0.0
MaxClients 10
MaxBandwidth 50000
NoDaemon
<Feed webcam.ffm>
file /tmp/webcam.ffm
FileMaxSize 10M
</Feed>
<Stream webcam.mjpeg>
Feed webcam.ffm
Format mjpeg
VideoSize 320x240
VideoFrameRate 10
VideoBitRate 20000
VideoQMin 1
VideoQMax 10
</Stream>
<Stream stat.html>
Format status
</Stream>
Then you can cd /usr/src/ffmpeg
and use the following command to run the server ffserver -f /etc/ff.conf_original & ffmpeg -v quiet -r 5 -s 320x240 -f video4linux2 -i /dev/video0 http://localhost/webcam.ffm
However the path or name of your ffserver.conf file may differ. Note that his is named ff.conf_original.
Note that i had to insert the port number into the url for it to work e.g. i /dev/video0 http://localhost:80/webcam.ffm
you can check if the stream is working by using stream_mjpeg_video.py or use VLC player on your pc to stream http://INSERT YOUR RASPI IP ADDRESS HERE:80/webcam.ffm
Next you can setup the drive_api.py file. Do this by first cd self-driving-car
then sudo nano drive_api.py
if you're car has exactly the same setup and wiring as Ryan's, then I don't believe you have to change anything. However if you need to implement different motor control you will have to modify the file.
run the scrip using the following command
sudo python3 drive_api.py --speed_percent 50
then navigate to http://INSERT YOUR RASPI IP ADDRESS HERE:81/drive
then click the white space on the page.
you should then be able to control the car over the server using the arrow keys.
Ensure python is installed on your PC. You will likely need to install required libraries and dependencies (Open CV, Numpy etc)
Clone the repo as stated before.
Once you are ready to collect data, cd into the location where you saved the repo, then use the following command to run the scrip that saves the video data.
python save_streaming_video_data.py --ip INSERT YOUR RASPI IP ADDRESS HERE
Then follow Ryan's instructions on the procedure to end the session.
There may be some gaps in these instruction but i hope they help you and others get past this stage! Good luck!
@zfhall Thanks a lot!
Hello RyanZotti, I've some problem with using ffmpeg. i use
cd /usr/src/ffmpeg
... after i runsudo ffserver -f /etc/ff.conf_original & ffmpeg -v quiet -r 5 -s 320x240 -f video4linux2 -i /dev/video0 http://localhost/webcam.ffm
It shows no such file directory for /
etc/ff.conf_original
... 😐