Investigating Kernel Panic Logs
The most common misconception when dealing with silent reboots is that the absence of entries in/var/log/syslog means no error occurred. In reality, if the kernel panics or the system hard-resets due to a hardware fault, the write buffer may not flush to disk before the power cycle completes. To diagnose this, you must look at the boot logs from the previous session rather than the current one.
Use the command journalctl -b -1 -e to view the end of the logs from the last boot (-b -1) and focus on the tail end (-e). This often reveals OOM (Out of Memory) kills, GPU driver crashes, or CPU temperature warnings that were truncated in the live log. If you see messages related to NVRM (NVIDIA Video Resources) or thermal, the issue is likely tied to hardware constraints rather than FFmpeg itself. Additionally, check for KASAN (Kernel Address Sanitizer) reports which indicate memory corruption, a frequent culprit when FFmpeg accesses large buffers in RAM.
Hardware Stress and Power Delivery
FFmpeg is an extremely CPU-intensive task, especially when encoding video with codecs like H.265 or using multi-threaded filters. On Ubuntu systems, particularly those with custom builds or overclocked components, this sudden spike in power draw can expose weaknesses in the Power Supply Unit (PSU) or motherboard voltage regulation modules (VRMs). If your PSU cannot maintain stable voltages under load, the system will trigger an automatic shutdown to protect components, resulting in a reboot that leaves no software trace. To test if this is a power issue, monitor your system temperatures and voltages during encoding. Tools likesensors or lm-sensors can provide real-time data. Look for CPU cores hitting their thermal throttle limit (typically 90-100°C for modern Intel/AMD CPUs) or VRM temperatures spiking. If the system shuts down precisely when CPU usage hits 100%, it is highly probable that thermal protection is engaging. Ensure that case airflow is sufficient and that thermal paste is applied correctly between the CPU heat spreader and the cooler.
Another factor is RAM stability. FFmpeg processes large datasets in memory, which can trigger errors in unstable DIMMs. Running a memory test via memtest86+ from the GRUB menu can rule out faulty hardware. While less common than thermal issues, ECC (Error Correcting Code) memory failures can also cause silent kernel panics that result in reboots.
Driver and Kernel Compatibility
If hardware checks pass, the issue may lie in how the Linux kernel interacts with your specific hardware drivers. Certain versions of the NVIDIA proprietary drivers, for instance, have known issues with FFmpeg’s NVENC (NVIDIA Encoder) API, leading to kernel module crashes. Although the error message might not appear insyslog due to the crash timing, the underlying cause is the driver incompatibility.
Check your installed driver versions using ubuntu-drivers devices. If you are using a newer version of FFmpeg with an older kernel, or vice versa, there may be a mismatch in the V4L2 (Video for Linux 2) interfaces. Updating your kernel to the latest HWE (Hardware Enablement) stack available in Ubuntu can resolve these compatibility gaps. Run sudo apt install --install-recommends linux-generic-hwe-22.04 (adjusting for your Ubuntu version) to ensure you have the most recent driver support.
Furthermore, disable any unnecessary background services that might compete for I/O or CPU resources during encoding. While unlikely to cause a full reboot, they can exacerbate resource contention. For guidance on managing service shutdown orders to prevent conflicts during system changes, you might find Preserve Order of Closing Services While Shutting Down Linux useful for understanding how systemd handles resource allocation.
Optimizing FFmpeg Workloads
Once hardware and drivers are verified, optimize your FFmpeg command to reduce peak resource usage. Use the-cpu_used flag for x264/x265 encoders to balance speed and stability. For example, adding -cpu_used 2 can lower the intensity slightly while maintaining good quality. Additionally, avoid running other heavy applications simultaneously.
If you are using hardware acceleration, ensure your user has the correct permissions to access the GPU devices. Check the permissions of /dev/dri/renderD128 and add your user to the video group if necessary: sudo usermod -aG video $USER. This prevents permission-denied errors that can sometimes lead to process hangs and subsequent system timeouts.
For more advanced troubleshooting involving hardware detection, refer to Detecting Hibernation Phases, as similar diagnostic tools can help identify if your system is incorrectly entering low-power states during high-load operations.
Frequently Asked Questions
Why does my PC reboot without showing a Blue Screen or error message?
This behavior typically indicates a hardware-level safety mechanism, such as thermal shutdown or power supply failure, rather than a software crash. The operating system is forcibly cut off before it can display or log an error screen.
How can I check if FFmpeg is causing a kernel panic?
Run journalctl -b -1 -e immediately after a reboot to view the final logs from the previous session. Look for keywords like "Oops", "panic", or "segfault" near the end of the output to confirm a kernel-level failure.
Does updating Ubuntu fix FFmpeg reboots?
Updating to the latest HWE kernel often resolves driver compatibility issues between FFmpeg and hardware accelerators like NVIDIA GPUs. It ensures you have the most recent patches for V4L2 and DRM subsystems.
What is the safest way to test if my PSU is failing?
Monitor your system under maximum load using stress-testing tools while watching voltage rails with hwmon sensors. If voltages drop significantly below spec (e.g., +12V dropping below 11.4V) right before a reboot, the PSU is likely unable to sustain the load.
Can disabling hyperthreading prevent these reboots?
In some cases, yes. Hyperthreading can increase thermal density and power draw per core. Disabling it in BIOS reduces the thermal load and can stabilize systems that are borderline on cooling or power delivery capacity.