View Full Version : Searching a tool for changing FPS in RAW stream.
-QfG-
7th February 2023, 18:55
Hi there,
I'm searching for a tool to manipulate/change the framerate of HEVC RAW streams (of course without reencoding). Nothing that changes the framerate in container only how mkvtoolnix will do it. Anyone here one idea?
von Suppé
11th March 2023, 13:38
I always use ffmpeg.exe. Example: source = input hevc. Rewrite timestamps for 23.976:
ffmpeg -i input.hevc -c copy -bsf:v hevc_metadata=tick_rate=(24000/1001):num_ticks_poc_diff_one=1 output.hevc
-QfG-
12th March 2023, 07:01
Thanks. That it! I build a little Batch file for this and it works perfectly. Works directly with all supported FFMPEG Containers, Output as RAW STream (supports AVC/HEVC).
@echo off & setlocal
SETLOCAL EnableDelayedExpansion
CHCP 1252>nul
mode con cols=120 lines=50
TITLE Video FPS Changer [Team QfG] v0.1 beta
set "FFMPEGpath=%~dp0tools\ffmpeg.exe"
set "FPS="
set "CODEC=HEVC"
echo Copyright (c) 2023 TeamQfG
echo.
echo ====================================
echo Video FPS Changer
echo ====================================
echo.
IF "%~1"=="" (
echo.
call :colortxt 0E "No Input File. Drag and Drop a file over this script." /n
echo.
goto :EXIT
)
:START
cls
echo Copyright (c) 2023 TeamQfG
echo.
echo ====================================
echo Video FPS Changer
echo ====================================
echo.
echo.
call :colortxt 0F " ==" & call :colortxt 0E " SET VIDEO CODEC " & echo ===================================================================================================
echo.
echo C. CODEC [%CODEC%]
echo.
call :colortxt 0F " ==" & call :colortxt 0E " SET NEW FRAMERATE AND START " & echo =======================================================================================
echo.
echo 1. 23,976
echo 2. 24
echo 3. 25
echo.
echo ======================================================================================================================
echo.
echo Change Settings ^!
CHOICE /C C123 /N /M "Select a Letter C, 1, 2, 3"
if errorlevel 4 (
set "FPS=25"
goto :CONVERT
)
if errorlevel 3 (
set "FPS=24"
goto :CONVERT
)
if errorlevel 2 (
set "FPS=24/1.001"
goto :CONVERT
)
if errorlevel 1 (
if "%CODEC%"=="HEVC" set "CODEC=AVC"
if "%CODEC%"=="AVC" set "CODEC=HEVC"
)
goto :START
:CONVERT
cls
echo Copyright (c) 2023 TeamQfG
echo.
echo ====================================
echo Video FPS Changer
echo ====================================
echo.
call :colortxt 0F " ==" & call :colortxt 0E " CONVERT FPS " & echo =======================================================================================================
echo.
echo Changing FPS to %FPS%. Please wait...
echo.
"%FFMPEGpath%" -i "%~1" -loglevel error -stats -an -sn -dn -c copy -bsf:v hevc_metadata=tick_rate=%FPS%:num_ticks_poc_diff_one=1 "%~dpn1_[FPS CHANGED].%CODEC%"
goto :EXIT
:EXIT
TIMEOUT 30
SETLOCAL DisableDelayedExpansion
exit
:colortxt
setlocal enableDelayedExpansion
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:colorPrint Color Str [/n]
setlocal
set "s=%~2"
call :colorPrintVar %1 s %3
exit /b
:colorPrintVar Color StrVar [/n]
if not defined DEL call :initColorPrint
setlocal enableDelayedExpansion
pushd .
':
cd \
set "s=!%~2!"
:: The single blank line within the following IN() clause is critical - DO NOT REMOVE
for %%n in (^"^
^") do (
set "s=!s:\=%%~n\%%~n!"
set "s=!s:/=%%~n/%%~n!"
set "s=!s::=%%~n:%%~n!"
)
for /f delims^=^ eol^= %%s in ("!s!") do (
if "!" equ "" setlocal disableDelayedExpansion
if %%s==\ (
findstr /a:%~1 "." "\'" nul
<nul set /p "=%DEL%%DEL%%DEL%"
) else if %%s==/ (
findstr /a:%~1 "." "/.\'" nul
<nul set /p "=%DEL%%DEL%%DEL%%DEL%%DEL%"
) else (
>colorPrint.txt (echo %%s\..\')
findstr /a:%~1 /f:colorPrint.txt "."
<nul set /p "=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%"
)
)
if /i "%~3"=="/n" echo(
popd
exit /b
:initColorPrint
for /f %%A in ('"prompt $H&for %%B in (1) do rem"') do set "DEL=%%A %%A"
<nul >"%temp%\'" set /p "=."
subst ': "%temp%" >nul
exit /b
:cleanupColorPrint
2>nul del "%temp%\'"
2>nul del "%temp%\colorPrint.txt"
>nul subst ': /d
exit /b
von Suppé
12th March 2023, 08:13
Thank you for the script, -QfG-. Will give it a go, as I currently work with separate small .cmd files for each framerate.
Works directly with all supported FFMPEG Containers, Output as RAW STream
In the past I've experienced trouble with ffmpeg and container in-/output. Never could lay my finger on it. But ever since, I always use ffmpeg for elementary streams only, both in- and output.
...(supports AVC/HEVC).
FYI MKVToolNix can rewrite timestamps for raw AVC stream too. I do this in the GUI by both setting the proper "Default duration/FPS" and checking "Fix bitstream timing info". Last time I checked, does not work for HEVC. Maybe Mosu will add support for it someday.
-QfG-
12th March 2023, 20:01
FYI MKVToolNix can rewrite timestamps for raw AVC stream too. I do this in the GUI by both setting the proper "Default duration/FPS" and checking "Fix bitstream timing info". Last time I checked, does not work for HEVC. Maybe Mosu will add support for it someday.
Thats the problem, mkvtoolnix will not edit HEVC streams.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.