ffmpeg drawtext timecode changes duration

0

normally when I change framerates, I use Adobe Premiere and interpret video material as new framerate, so the duration changes. Thats fine. But because this is a mkv file I wanted to convert, I use ffmpeg.

But I have a weird problem with ffmpeg while adding timecode.

The code I am using looks like this:

/Applications/ffmpeg -probesize 50M -analyzeduration 100M -i "$f" -map 0:0 -map 0:1 -c:a pcm_s24le -async 1 -c:v dnxhd -b:v 36000k -r 25 -s 1920x1080 -aspect 16:9 -pix_fmt yuv422p -coder ac -trellis 0 -colorspace bt709 -color_range mpeg -subq 6 -me_range 16 -sc_threshold 40 -keyint_min 25 -g 50 -metadata creation_time=now -af atempo=1/0.95904 -vf setpts="0.95904*PTS" -vf drawtext="fontsize=30:fontfile=/library/fonts/tahoma.ttf: timecode='01\:00\:00\:00': r=25: x=main_w-180: y=30: fontcolor=white@1: box=1: boxcolor=0x00000000@1" -sn -y "/Volumes/videos/$FILENAME.mov" 

The created video is about 42min long.

When I render the video without drawtext:

/Applications/ffmpeg -probesize 50M -analyzeduration 100M -i "$f" -map 0:0 -map 0:1 -c:a pcm_s24le -async 1 -c:v dnxhd -b:v 36000k -r 25 -s 1920x1080 -aspect 16:9 -pix_fmt yuv422p -coder ac -trellis 0 -colorspace bt709 -color_range mpeg -subq 6 -me_range 16 -sc_threshold 40 -keyint_min 25 -g 50 -metadata creation_time=now -af atempo=1/0.95904 -vf setpts="0.95904*PTS" -sn -y "/Volumes/videos/$FILENAME.mov"

Than the rendered video duration is 40min59sec. That is the duration I wanted to and it's the same Adobe creates.

Why is the video duration, with the timecode drawed in the picture, longer than without?

How can I convert the mkv to a DNxHD with 25fps and burned-in timecode, using ffmpeg, the correct way, please?

audio
ffmpeg
video
conversion
video-conversion
asked on Super User Mar 17, 2021 by jackspost • edited Mar 17, 2021 by llogan

1 Answer

0

Your log says:

Multiple -filter, -af or -vf options specified for stream 0, only the last option '-filter:v drawtext' will be used.

Which means your setpts is being ignored and therefore the duration is longer.

Use only one -vf or use -filter_complex for both audio and video filtering:

/Applications/ffmpeg -probesize 50M -analyzeduration 100M -i "$f" -map 0:0 -map 0:1 -c:a pcm_s24le -async 1 -c:v dnxhd -b:v 36000k -r 25 -s 1920x1080 -aspect 16:9 -pix_fmt yuv422p -coder ac -trellis 0 -colorspace bt709 -color_range mpeg -subq 6 -me_range 16 -sc_threshold 40 -keyint_min 25 -g 50 -metadata creation_time=now -af atempo=1/0.95904 -vf setpts="0.95904*PTS,drawtext=fontsize=30:fontfile=/library/fonts/tahoma.ttf: timecode='01:00:00:00': r=25: x=main_w-180: y=30: fontcolor=white@1: box=1: boxcolor=0x00000000@1" -sn -y "/Volumes/videos/$FILENAME.mov"
answered on Super User Mar 17, 2021 by llogan • edited Mar 17, 2021 by llogan

User contributions licensed under CC BY-SA 3.0