Search code examples
ffmpegvideo-thumbnails

How to generate tile with video thumbnails with right timecode


I'm using FFMPEG library for generating video thumbnails every 5 sec with time codes using following command:

 ffmpeg \
-i 20051210-w50s.flv \
-y \
-frames 1 \
-vf " \
    select=not(mod(t\,5)), \
    scale=320:-1, \
    drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: \
    timecode='00\\:00\\:00\\:00': r=25: fontcolor=white: x=220: y=220: box=1: [email protected], \
    tile=5x2" \
-vsync 0 \
out.jpg

enter image description here It gererate right thumbnails tile, but timecodes is wrong. How to solve this issue?


Solution

  • The drawtext filter is not referencing the timestamp. It uses a simple counter that increments the timecode for each new frame. So, the way to do this is to draw each timecode and then drop frames.

    ffmpeg \
    -i 20051210-w50s.flv \
    -y \
    -frames 1 \
    -vf " \        
        scale=320:-1, \
        drawtext=fontfile=/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: \
        timecode='00\\:00\\:00\\:00': r=25: fontcolor=white: x=220: y=220: box=1: [email protected], \
        select=not(mod(t\,5)), \
        tile=5x2" \
    -vsync 0 \
    out.jpg