VideoHelp Forum




+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 32 of 32
  1. edit; delete, wrong thread
    Last edited by imaginethat; 19th Jan 2022 at 01:15.
    Quote Quote  
  2. It's really of no interest to me but sometimes I like to learn things. I added some metadata via an SRT and a downscaling option:

    Code:
    @echo off
    
    REM user variables.  Set these to the desired values.
    REM cols is the number of columns for the image array.
    REM t_interval is the time interval in seconds.
    REM downscale is the factor by which to downscale the thumbnails, eg 2 results in half size thumbnails
    
    set /A cols = 3
    set /A t_interval = 30
    set /A downscale = 1
    
    
    REM get video stats:
    
    ffprobe.exe -v quiet -show_entries stream=r_frame_rate -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 > temp.txt
    set /p fps= <temp.txt
    ffprobe.exe -v quiet -show_entries stream=width -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 > temp.txt
    set /p width= <temp.txt
    ffprobe.exe -v quiet -show_entries stream=height -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 > temp.txt
    set /p height= <temp.txt
    ffprobe.exe -v quiet -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 > temp.txt
    set /p duration= <temp.txt
    
    
    REM At this point the environment variables cols, t_interval, fps, duration, width, and height are available.
    REM
    REM Note 1 fps is in numerator/denominator format -- convert to an integer with set /A frate = fps.
    REM Note 2: caculate the number of rows.
    REM note 3: calculate the frame count interval from user t_interval * frate
    
    set /A frate = %fps%
    set /A rows = duration / t_interval / cols
    if %rows% EQU 0 set /A rows = 1
    set /A interval = t_interval * frate
    set /A width = (%width% / %downscale% / 2) * 2
    set /A height = (%height% / %downscale% / 2) * 2
    
    
    REM get metadata into SRT
    
    echo 1 >temp.srt
    echo 00:00:00,000 --^> 00:00:%t_interval%,000 >>temp.srt
    echo "%~nx1" >>temp.srt
    echo dimensions: %width%x%height% >>temp.srt
    echo duration: %duration% seconds >>temp.srt
    
    ffprobe.exe -v quiet -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 > temp.txt
    set /p codec_name= <temp.txt
    echo video codec: %codec_name% >>temp.srt
    
    
    
    REM for debugging
    REM echo duration = %duration%
    REM echo fps = %fps%
    REM echo frate = %frate%
    REM echo width = %width%
    REM echo height = %height%
    REM echo downscale = %downscale%
    REM echo cols = %cols%
    REM echo rows = %rows%
    REM echo interval = %interval%
    REM pause
    
    @echo on
    
    ffmpeg -y -i %1 -vf "subtitles=temp.srt,thumbnail=%interval%,scale=%width%:%height%,tile=%cols%x%rows%" -frames:v 1 "%~dpnx1.jpg"
    
    pause
    
    REM delete temp files
    del temp.srt
    del temp.txt
    I just realized that the frame size that's burned into the image is the scaled size, not the original size. I'm sure you can figure out how to fix that.

    103 minute movie, 1920x1080, rows=4, t_interval=300, downscale=2:

    Image
    [Attachment 62992 - Click to enlarge]
    Last edited by jagabo; 19th Jan 2022 at 13:16.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!