Close

Video Editing 1: Successful Attempt #1

A project log for Raspberry Pi 400 Daily Driver

Learning to use a Raspberry Pi 400 laptop as an everyday computer and sharing the results.

dustinDustin 11/24/2021 at 19:000 Comments

I finally got this thing working and am ready to try to make a video. I'll start by outlining the overall process. After I install Handbrake...

Done.

There are two ways I can do this right now, as I am starting with 4K video files. The first is to just shove them into Kdenlive and let it render them down into proxy versions that I can actually work with. The second is to run all the files through Handbrake ahead of time to compress the files down to 1080p before I try to edit them. If I do this, I'll be rendering the files twice: Once to drop from 4K to 1080p, then again in Kdenlive to drop them down further for proxy versions. Thinking about it, the proxy render is unavoidable due to the low power nature of the Pi 400. Proxy rendering may be faster if I start with 1080p videos, but I'm not sure. If I know I will be making a video and have time, I'll compress the video files ahead of time. Otherwise, I may just see if Kdenlive can make proxy files in a reasonable time. I was writing this log as I go in Firefox, but want to free up system resources so I will switch over to WordGrinder and paste the log back into here when done. Saving the draft. Never mind, can't get what I have into WordGrinder, using notepad... I forgot to install VLC Media Player. The whole audio failure has really thrown me through a loop here. At least I get to open a ton of programs and windows at once and see how the system handles it. I'd say far better than before. I'm guessing there was an update somewhere that crippled the entire system. It feels much ore responsive.

Testing Kdenlive with a 4K file first, as I have them handy. I suspect the videos I have labeled as "final" are already 1080p, judging by the file size. I'll try to find the 4K version of one of these files and test both in Kdenlive. VLC codec info confirms this is a 1080p version of the file. Labeling it in the file name. It turns out I don't have the original 4k file handy. I do have a bunch of 4k files shot from a different point of view. They all need converted to 1080p for this project, which will be a good test. I just spent the past 15 minutes or so just organizing the media for this project. It really needed cleaned up. I have a folder template for video projects that makes it easy to organize everything. I have a log file where I typed up notes originally. I need to go back through it and figure out where I left off. Had I not done all of that, I'd be rather overwhelmed with this project right now. Most of the work here is just organizing and preparing for the creative work. So far, the Pi has hadled things admirable. Pop!_OS has done exactly as it was supposed to and stayed out of my way. I haven't had any OS distractions after I set up the floating windows exceptions, which stops certain windows from resizing automatically. Specifically I set up VLC and Kdenlive to ignore tiling requests. This means they both open full screen every time. VLC freaks out when it opens a video and tiling tries to put it somewhere. It was slowing things down.
I need a to do list for this right now:

Set up battery bank as UPS for the Pi as the power in my camper goes out randomly when I turn on too many things.
Watch, name, and organize the unsorted 4k files. Requires modifying the config.txt to allow 4k playback, which I disabled. Alternatively, I can simply let Handbrake compress them down to 1080p. This is the better solution as it needs done anyway.

Switch to a text editor with autosave in case the system locks up or power is lost.

Test Kdenlive with 4k and 1080p videos.

Do the actual creative work and render the final video.

There is a lot to do here, but it is coming along nicely. I will start with setting up the battery bank as a UPS to make sure I will have stable power. Well that failed quite nicely. The battery bank was causing the Pi to throw the low voltage alarm, so I went back to wall power. I have a 12 volt battery bank in mind that can run the Pidock 400 and Pi 400, but it’s nearly $200 and I have other things to worry about. I hope to add an internal battery some day.
I finally got Kdenlive running with audio. I set up proxy clips to use the vaapi h264 encoding profile and added a small 4K clip. It works surprisingly well so far. Adding a second, larger 4K clip and waiting on the proxy clip to generate. The experience, even when scrubbing through clips is quite good. It’s a better experience on the Pi 400 than my MSI GE60 laptop with Shotcut and a dedicated Nvidia 765m GPU. Proxy clips really is the key to getting this working. It failed to even play the 4K clips and froze the program the first try. I am very pleased and surprised so far.

Rendering my first clip now. It’s 1 minute long, going from 4K to 1080p as fast as possible. That failed beautifully. The render consumed all of the RAM and crashed the entire system very gracefully. There is no swap space on this system, so I think I will address that. I need to find ways to reduce the RAM usage, but not sure if that is possible. It was going at 5fps and would have taken less than 10 minutes to render a 1 minute 4K clip. That’s not unreasonable. A 10 minute video would take about 100 minutes. Start the render, go do something else, done. LibreOffice Writer did an admirable job recovering this log file after the crash. I created an 8GB swap file and got it running. Trying the render again. RAM usage never went above 2.3GB of the 3.8GB available and swap was completely untouched. It held steady at 18fps with spikes of 38fps. I used the same settings in both tests as Kdenlive recovered the project after the crash. I did set it up to render using all 4 cores, and all 4 were indeed at 100% nearly the entire time. The OS was still reasonably responsive. I’m quite surprised with performance here. The video quality was terrible, but that was to be expected at the fastest setting. I turned it down to the slowest setting for this next test. Holding steady around 2.6GB of RAM usage, and 1fps. ETA of 7 minutes for a 1 minute 4K clip. Still not bad. It’s not “needs to run overnight” slow. More like “might as well eat your lunch” slow. I’m ok with that. Very good for a $100 pc trying to work with 4K video files. I can work with this. The system is still quite responsive, considering the CPU is completely maxed out. ETA has jumped up to 18 minutes for the 1 minute clip. A 10 minute video would take 180 minutes at that rate. 3 hours. Still not bad for dealing with 4K. I don’t need to be editing and rendering full time. Just a video every few days or weeks. It can run overnight no problem. I still plan to build a Pi CM4 based video editing system at some point that can sit around rendering all day while I use my Pi 400. I don’t recommend this set up if it can be avoided, but you definitely can get some editing and real work done on the Pi 400. We’re down to 0fps now. Hasn’t crashed yet. I am running a 2.2GHz overclock, but it may be thermal throttling for all I know. Going to let it finish and see what comes out the other end.

Bored, opening Firefox to see if I can do something productive while this poor thing tries to spit out that video file. 3.0GB of RAM used(80%). It is working by some miracle. I’ve read a few HaD articles without incident. The boot drive is painfully hot to the touch though. I chose a Samsung Bar as it’s what I had on hand, but it is working very well. Being metal, it does help conduct the heat away. The poor Pi is burning up though. Even maxing out the entire system, it is still far more responsive than when I had the system fully updated. It seems there was something going on before that caused the entire system to slow down. It’s almost responsive as a cheap smartphone, even under full load. Good job Raspberry Pi. Rendering completed in 32:35. Just realized I didn’t have the GPU overclocked. Setting to 750MHz for now.
The latest video render has completed and the results are hideous. Very blocky. On the next test I’ll use the “lossless” x264 codec option. I’m still learning the basics here, but I am making progress. The 1080p videos that came out of handbrake on my old laptop look fantastic. The ones from Kdenlive look like crap. If I can fix that, I will be ok with video editing on this Pi. After I shut down everything, LibreOffice Writer started acting weird until I shut it down and restarted it a few times. Video playback on VLC was also terrible until I set it to use 4 cores under the Codec section. It was far better. Even fairly good. Restarting the Pi and trying again with the lossless codec. I also went and found a way to check if hardware acceleration is in use and how to make various programs use it. It was enabled and working by default in Pop!_OS, which is fantastic and unexpected. I guess I should expect it from System76. I am a huge fan these days. I had to enable it in Firefox and VLC Media Player, and install the H264ify extension in Firefox, but they are minor changes. Going to re-enable 4K output over HDMI and see just how well it works in VLC. 4K videos still get stuck on one frame and play audio. No luck at all. 1080P playback is better, but still a little choppy. YouTube at 720p in Firefox is acceptable, 1080p is not great.
Moving onto the next render test: Lossless. This went better than the previous test. RAM got maxed out and 1.2GB of swap was used, but the render finished. The results are far better. I can’t actually play the file with VLC, but the single video frame that rendered looked very good. The lossless x264 codec is the way to go. I started with 692MB of 4K video files and ended up with a single 1.5GB 1080p video file. That’s a very large file for a 1 minute clip. Going to check render options in Kdenlive and may just compress with Handbrake if there aren’t any good options there. The quality is more than good enough to upload to YouTube. This is excellent progress. I have been at this for about 7 hours now, and am happy to get such good results. I just realized that I only ever adjusted the encoder speed, not the actual quality settings of the h264 encoder. I’m very tired, so I will try again tomorrow and post this log.

I feel that the Pi 400 is acceptable for video editing, provided you have the time and patience. It will not hold up to production environments, and even playing back files can be problematic. I feel I’ve given this Pi the best chance I can for the time being. Running Pop!_OS, with hardware acceleration enabled, an overclock, and running from fast storage devices makes a huge difference. I may test video editing with a stock Pi 400 and OS at some point, but I suspect it will be significantly slower. I have some hardware upgrades planned that should speed things up even more. I recommend the Pi 400 for anyone who needs a cheap and capable PC. I recommend running Pop!_OS on it as well, provided you do not update the OS and just install the software you need until the audio issue is fix. I will clone this drive and eventually make a system image of it, both for my personal use, and to distribute to anyone who wants to try it out. I am still new to much of this, but feel I’ve made decent progress.

The following pictures show the difference between the first attempt and the second attempt.

It may be hard to see the difference, but the video quality differs greatly. I can make this work for simple projects and will finish my fish video on the Pi 400 soon.

Discussions