Raspberry Pi Fireplace Video Looper (Pireplace)

4

I live in Texas. Most of the year, we have no use for a fireplace as temperatures frequently get over 100 degrees Fahrenheit. However, I have always enjoyed having a fireplace going for ambiance. One day I was sitting in my living room and noticed that the fireplace was about the same size as an old TV I had lying around. After a few quick measurements, the ecstatic feeling of all the measurements being perfect, and a little bit of work, I had a virtual fireplace crackling away powered by a Raspberry Pi. So I thought I would share how to make your own.

I’ll skip past the whole getting the right tv to fit your fireplace. Let’s just jump into the Raspberry Pi setup. Here is a little video of my fireplace so you can see what we are going for.

A video posted by Jaret Burkett (@jaretburkett) on

Start with a fresh Raspbian Jessie (the full version) installed on a Raspberry Pi (the Pi2 or better is recommended. I had bad luck with a Pi Zero. It is not powerful enough for the video). The first thing we want to do is expand the filesystem. From the terminal, type the following command.

Select “Expand Filesystem”

Now we need to force the raspberry pi to boot into the console instead of the Desktop. While in the raspi-config, go to “Boot Options” and select “B2 Console Autologin”.

If you have black bars around your tv, you can also disable overscan by going to “Advanced Options” then “Overscan” and disable it.

You might also want to increase your video memory since we will primarily be playing video. You can also do this in the “Advanced Options” section under “Memory Split”. I put mine at 128.

Now select Finish and choose yes on the reboot prompt.


Now, there is a problem with the way the Pi boots. It will only use the HDMI connection if the TV is on. We are designing this to run a continuous loop and the pi may boot up with the TV off. So we need to force the HDMI connection. This may be different for each tv.

First, in the console we need to edit the config.txt file.

First, we need to force HDMI hotplug so it will enable HDMI even if the TV is off. Uncomment #hdmi_force_hotplug=1 so it looks like this.

Next, for the video player to be able to use the HDMI connection at the correct resolution even if the TV is off, we have to specify the TV settings by uncommenting and editing the hdmi_group and the hdmi_mode values. You can find which values are right for your tv on the documentation for the config.txt file here. Just scroll down to the HDMI_MODE section. I am going to set mine up for 1080p at 60hz, which will probably work on most modern HD TVs. To do this, I change hdmi_group and the hdmi_mode to this.

Now, we can save that, Ctrl+x y [enter].

Lets setup the video player now. we will create a new directory for our script.

We need a video file to loop. I am going to grab one from youtube, but you can get one from wherever you want. I like this one.

to grab the video, we are going to use youtube-dl. Install it using the following command.

You can read about options for youtube-dl here.

To get the video shown above, we enter the following command. This video is about 3gb, so make sure you have a large enough sd card to hold it.

This will obviously take some time, as this video is large. Next, lets rename the video to something easier to manage. We want to see what the video name is first.

Our video is named “Burning Fireplace with Crackling Fire Sounds (Full HD)-0fYL_qiDYf0.mp4” and I want it named fireplace.mp4. to do that, enter the following command. (use a backslash \ in front of spaces in command line)

It is script time ladies and gentlemen. we are going to place our script file in the videolooper folder.

Now place the following in the blank file. It will make the video run on a loop and force audio out to HDMI.

Save and exit. Ctrl+x, y [enter]. Make it executable.

Now, you can test it if you want.

The video should start playing on your TV. Press Ctrl+c to exit. Now we want to set it up to run on boot.

If it asks which editor you want to use. I prefer nano, but it is up to you. Then, you want to add the following to the very bottom of that file.

Save and exit using Ctrl+x, y, [enter].

Now, give it a reboot and it should start playing automagically.

The video should start playing at boot and run on a loop. If the pi resets whith the tv off, the video will play anyway with the tv off. If you turn the tv back on, it will continue to play at the right aspect ratio and force audio to play through the hdmi. With this method, all you have to do is turn the tv off and on and the video will always be playing.

I hope you enjoyed this tutorial and that it was beneficial. If you have any questions or comments, leave them in the comment section. Enjoy your virtual fireplace or Raspberry Pireplace.

Share.

About Author

I love to tinker, code, and create electronics. I primarily focus on Raspberry Pi (and other linux SBCs) and Arduino (and other microcontrollers that run on the Arduino platform).