Docker Community Forums

Share and learn in the Docker community.

Streaming and saving file locally

Hi, I was looking for ways to stream video to Youtube and came across this guide. I downloaded a docker image linked in the guide and the stream worked fine. However, I wanted to stream and save the video to an SD card on my Raspberry pi simultaneously. To achieve this, I had to make some changes to the image and then build it again. However, when I configure the command to give me two outputs, the stream doesn’t seem to work and I get the following error message:

No such file or directory

I think this problem has something to do with Docker and how it manages containers and files stored inside these containers. I’m very new to Docker so I would appreciate it if you could solve this problem.

Please share the Dockerfile you createed and the exact commands you used to start your container.

Here is the Dockerfile I created:

I used this command for pulling the container image from Docker:

docker pull alexellis2/streaming:17-5-2017

I used the following command to stream to YouTube:

docker run --privileged --name cam -ti alexellis2/streaming:latest xxxx-xxxx-xxxx-xxxx

I used this command to build the image:

        docker build -t alexellis2/streaming .

Regardless wether the commands in your entrypoint work or not, you do not map any volumes into the container… How do you expect the data to be written to your sdcard without a mapped volume or a bind-mount?

docker run --privileged --name cam -ti -v /path/to/sd:/home/pi/streaming alexellis2/streaming:latest xxxx-xxxx-xxxx-xxxx

From what I understand, volumes are used to mount local files to the docker container. In my case, I want to transfer files from the docker container to my local file system. As you can see above, I need two outputs: one which streams the video to YouTube and another which saves the video to an SD card. I’m using a command-line program called FFmpeg to achieve this. I was able to get the live stream working using this method but couldn’t get a video file on my SD card. This led me to think that maybe the file was being saved in the Docker container because this is where the program was being run. I tried to use the docker cp command to copy the file from the container to my local file system but it just gives me the following error message:

I think that maybe the video is being stored somewhere else instead of the container I’m trying to transfer it from. The question is how I can access this video file and then transfer it to my local sd card.

1 Like

Your understanding covers just a subset of the the use cases. You might want to re-read the docs about volumes again.

Instead of mapping a folder into that container that can be used to directly write the data to the sdcard, you prefer to manualy copy files from the container to the host. uhm, if this is what you want… carry on :slight_smile:

I’m sorry, I’m new to docker so I apologize for any misunderstanding. I tried what you just said. I specified ffmpeg to save the file to /path/to/sd. I got this error message:

Slave ‘/path/to/sd/my_video.mp4’: error opening: No such file or directory