Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th February 2023, 18:55   #1  |  Link
-QfG-
QfG Group Germany
 
-QfG-'s Avatar
 
Join Date: Oct 2018
Location: Germany
Posts: 245
Searching a tool for changing FPS in RAW stream.

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?
-QfG- is offline   Reply With Quote
Old 11th March 2023, 13:38   #2  |  Link
von Suppé
Registered User
 
von Suppé's Avatar
 
Join Date: Dec 2013
Posts: 629
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
von Suppé is offline   Reply With Quote
Old 12th March 2023, 07:01   #3  |  Link
-QfG-
QfG Group Germany
 
-QfG-'s Avatar
 
Join Date: Oct 2018
Location: Germany
Posts: 245
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).

Code:
@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

Last edited by -QfG-; 12th March 2023 at 07:06.
-QfG- is offline   Reply With Quote
Old 12th March 2023, 08:13   #4  |  Link
von Suppé
Registered User
 
von Suppé's Avatar
 
Join Date: Dec 2013
Posts: 629
Thank you for the script, -QfG-. Will give it a go, as I currently work with separate small .cmd files for each framerate.

Quote:
Originally Posted by -QfG- View Post
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.

Quote:
Originally Posted by -QfG- View Post
...(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.
von Suppé is offline   Reply With Quote
Old 12th March 2023, 20:01   #5  |  Link
-QfG-
QfG Group Germany
 
-QfG-'s Avatar
 
Join Date: Oct 2018
Location: Germany
Posts: 245
Quote:
Originally Posted by von Suppé View Post
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.
-QfG- is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:20.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.