Skip to content

Instantly share code, notes, and snippets.

@kampar
Created September 8, 2025 23:04
Show Gist options
  • Select an option

  • Save kampar/29ad1b36c2586b5a671d968530df9e11 to your computer and use it in GitHub Desktop.

Select an option

Save kampar/29ad1b36c2586b5a671d968530df9e11 to your computer and use it in GitHub Desktop.
drop your .m3u8 files into this cmd in your windows explorer
@echo off
setlocal
rem -----------------------------------------------------------------------------
rem m3u8_to_mp4.cmd - Converts a file using FFmpeg. (Verbose Debug Version)
rem
rem This script provides detailed feedback on each step of the process
rem to help troubleshoot any issues.
rem -----------------------------------------------------------------------------
echo.
echo [DEBUG] Script starting...
echo.
rem --- 1. Check if an argument was provided ---
if "%~1"=="" (
echo [ERROR] No input file specified. The script needs a file to work on.
echo.
echo [USAGE] Drag and drop your .m3u8 file onto this script icon,
echo or run from the command line like this:
echo %~n0 "C:\path\to\your file.m3u8"
echo.
goto :End
)
echo [INFO] Raw argument received: "%~1"
echo.
rem --- 2. Check if the provided input file actually exists ---
if not exist "%~1" (
echo [ERROR] The input file could not be found at the path you provided.
echo [CHECK] Please verify the path and filename are correct.
echo [PATH] "%~1"
echo.
goto :End
)
rem --- 3. Determine full input and output file paths ---
rem %~1 - The full path of the file provided (e.g., C:\videos\intro.m3u8)
rem %~dp1 - The Drive and Path of the file (e.g., C:\videos\)
rem %~n1 - The Name of the file ONLY (e.g., intro)
set "INPUT_FILE=%~1"
set "OUTPUT_FILE=%~dp1%~n1.mp4"
echo ======================================================
echo Preparing FFmpeg Conversion
echo ======================================================
echo.
echo [INFO] Input file has been identified as:
echo "%INPUT_FILE%"
echo.
echo [INFO] Output file will be saved to the same folder as:
echo "%OUTPUT_FILE%"
echo.
echo ======================================================
echo.
echo [ACTION] The following command will now be executed:
echo ------------------------------------------------------
echo ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "%INPUT_FILE%" -c copy "%OUTPUT_FILE%"
echo ------------------------------------------------------
echo.
rem --- 4. Execute the FFmpeg command ---
ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "%INPUT_FILE%" -c copy "%OUTPUT_FILE%"
echo.
echo ======================================================
echo Conversion process finished.
echo ======================================================
echo.
:End
echo Press any key to close this window.
pause >nul
@kampar
Copy link
Author

kampar commented Sep 8, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment