1

Ive been trying to get this work for a little while now and I think im just lacking some knowledge in something.

I am basically trying to convert a 60fps video down to 30fps and burn in timecode all at the same time.

So far I have

ffmpeg -y -r 60  -i IN.mov -pix_fmt yuv420p -timecode 10:03:13:27 -filter:v fps=30 -vf "[in]drawtext=fontfile='C\:/Windows/Fonts/arial.ttf': timecode='10\:03\:13\:27':timecode_rate=30:x=((w-text_w)/2)/3:y=((h-text_h)-h)+text_h:fontsize=24:fontcolor=white:box=1:boxcolor=black:boxborderw=5[out]"  -r 30 OUT.mov

I convert the 60 fps tc to 30 by hand for some of the values (eventually move this into python)

It all seems to work fine until you take a look at the burn in which seems to be counting at 30 but counting up in 2's. I can tell its something to do with the 60/30 conversion as obviously we are halving the frames. Im really trying to avoid multiple calls and 'temp' files.

If anyone could talk me through what im doing wrong and educate me a little that would be awesome

Thanks in advance guys

OliC
  • 21
  • 5
  • 1
    Working for me using a synthetic input: `ffmpeg -f lavfi -i testsrc2=d=60:r=60 -vf "fps=30,drawtext=font=mono:timecode='00\:00\:00\:00':timecode_rate=30:x=(w-text_w)/2:y=h-th-10:fontsize=24:fontcolor=white:box=1:boxcolor=black:boxborderw=5,format=yuv420p" output.mp4` . The timecode is synced to the timestamp. No need for `-r` as input or output options. Copy and paste all of the text from the log from your command. The log is important. – llogan Jul 22 '21 at 17:00
  • I thought this was going to fix it based on the example you pasted but alas it doesn't. It results in the same issue as before where the timecodes between 60 and 30 dont respect eachother. 10:03:15:00 should be the same image in both videos, else TC on the conversion would be useless. The example shows some promising stuff though, I tried putting my source file in to replace `testsrc2=d=60:r=60` but it returned saying `[lavfi @ 000002280adea600] No such filter: (my file location)` so I removed the `-f lavfi` which got the video loading but then re introduces the sync error. – OliC Jul 23 '21 at 05:02
  • Silly me, with the inclusion of my `-timecode` flag and removing the `-f lavfi testsrc2=d=60:r=60` I think I finally have it! Thank you! – OliC Jul 23 '21 at 05:14
  • 1
    The `-f lavfi -i testsrc2=d=60:r=60` was just to generate the fake video for testing purposes. – llogan Jul 23 '21 at 16:18

2 Answers2

1

The answer for me provided by llogan works with one or two edits for an input video.

ffmpeg -i input.mov -timecode 10:03:13:27 -vf "fps=30,drawtext=fontfile='C\:/Windows/Fonts/arial.ttf':timecode='10\:03\:13\:27':timecode_rate=30:x=(w-text_w)/2:y=h-th-10:fontsize=24:fontcolor=white:box=1:boxcolor=black:boxborderw=5,format=yuv420p" output.mov

Not entirely sure how the wizardry works here but its working!

OliC
  • 21
  • 5
0

Because -r 60 have to be 30

ffmpeg -y -r 30  -i IN.mov -pix_fmt yuv420p -timecode 10:03:13:27 -filter:v fps=30 -vf "[in]drawtext=fontfile='C\:/Windows/Fonts/arial.ttf': timecode='10\:03\:13\:27':timecode_rate=30:x=((w-text_w)/2)/3:y=((h-text_h)-h)+text_h:fontsize=24:fontcolor=white:box=1:boxcolor=black:boxborderw=5[out]"   out30fps.mp4
stevejobs
  • 391
  • 2
  • 4
  • This does not work. The result of this means that my timecode counts correctly but the 60fps video and the 30fps video do not match up. For example, the frame at 10:03:15:00 should look exactly the same in both videos but alas with the line you provided it does not. Setting that initial -r rate to 60 means that both videos line up from a timecode perspective. – OliC Jul 22 '21 at 07:59