How to Remux OBS Recordings via Command Line

This article explains how to automate the process of converting OBS Studio recordings from MKV to MP4 using command-line scripting. Because OBS Studio does not feature a native, standalone command-line argument specifically for its GUI remuxing tool, this guide covers the two most efficient workarounds: using FFmpeg (the engine powering OBS’s remuxer) to batch-remux via scripts, and triggering OBS’s auto-remux feature using command-line arguments.


OBS Studio performs remuxing internally using the FFmpeg library. To automate this process without opening the OBS GUI, you can call FFmpeg directly via a command-line script. This allows you to copy the video and audio streams instantly from .mkv to .mp4 without re-encoding.

Step 1: Install FFmpeg

Ensure you have FFmpeg installed and added to your system’s PATH variable.

Step 2: The Remux Command

To remux a single file, open your terminal or command prompt and run:

ffmpeg -i input.mkv -c copy output.mp4

Step 3: Automated Batch Scripting

For Windows (Batch Script - .bat):

Create a text file named batch_remux.bat in your recording directory and paste the following code to convert all MKV files to MP4 automatically:

@echo off
for %%i in (*.mkv) do (
    ffmpeg -i "%%i" -c copy "%%~ni.mp4"
)
pause

For Linux / macOS (Bash Script - .sh):

Create a script named batch_remux.sh, make it executable (chmod +x batch_remux.sh), and run it:

#!/bin/bash
for file in *.mkv; do
    ffmpeg -i "$file" -c copy "${file%.mkv}.mp4"
done

Method 2: Triggering OBS Auto-Remux via Command Line

If you want OBS Studio to handle the remuxing automatically upon finishing a recording session initiated from the command line, you can leverage OBS’s built-in “Auto-Remux” feature alongside OBS command-line launch arguments.

Step 1: Enable Auto-Remux in OBS

  1. Open OBS Studio.
  2. Go to Settings > Advanced.
  3. Under the Recording section, check the box for Automatically remux to mp4.
  4. Click Apply and close OBS.

Step 2: Command-Line Automation

You can now script the startup and shutdown of OBS recordings. When OBS is commanded to stop recording via CLI or hotkey, it will automatically execute the remux function before closing.

Windows Command Prompt:

start "" "C:\Program Files\obs-studio\bin\64bit\obs64.exe" --startrecording --headless

Linux Terminal:

obs --startrecording --headless

Once the recording is stopped (either by killing the process safely or using an OBS WebSocket script), the software will automatically generate the corresponding .mp4 file in your designated recording folder.