[FFmpeg-user] Add time code AND a watermark in one pass

Kevin Duffey kevinmduffey at yahoo.com
Wed Feb 28 00:07:55 EET 2018

Hi, thank you for the replies.
So here is my current script, and ill past some output below that. It is a windows .bat, but really the for loop is it, the ffmpeg call is the issue. I am NOT attempting to keep the video the same.. e.g. I want to convert it to h.265 AND add the timecode (starting at 00:00:00:00) and the watermark image in one pass if possible. btw..I know I am using h.264. 

 for /R %%a in ("*.mov") do ffmpeg -i "%%a" -i watermark.png -filter_complex "[1:v]scale=4096x2160 [ovrl],[0:v][ovrl]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2; [1:v]drawtext=fontfile='C\:/Windows/Fonts/arial.ttf':fontsize=35:timecode='00\:00\:00\:00':r=24:x=10:y=10:fontcolor=white" -s 720x480 -c:v libx264 -preset ultrafast -crf 20 d:\encoded\%%~na.mp4

So the above works.. in that it creates the h.264 video, resolution AND the overlay. However I do NOT see the timecode. If you look, I have a [1:v] and the output shows that it is stream 1 along with the overlay, being stream 1. I am guessing that is wrong. When I try using [2:v] it gives me an error indicating index 2 is invalid. So I am a bit lost yet as to how to get both the overlay image and the timecode in one pass. I was hoping the [] indicating the layer, with 0 on the bottom, 1 above (overlayed) and so forth.
I dont understand the filter_complex and using [1:v], [0:v], [ovr1], etc. I assumed 0 is the bottom layer, 1 the layer above, etc. I would assume then 0:v should be the main source file, where 1:v, 2:v, etc would be layer 1, 2, etc to overlay on top.
I got enough errors to see that you can have inputs and outputs using labels.. and that [ovr1] is a label and used in the chain.. but that is about all I got. 
Somehow I got timecode for a few seconds, then the video ended abruptly.. in that i had the overlay AND a tiny text of timecode show up in upper left corner (that is where i want it so set x to 10, and y to 10. I cant seem to get that back now.
So, I am able to get the overlayed image and the video, but no timecode shows up.

    On Sunday, February 25, 2018, 9:49:34 AM PST, Carl Zwanzig <cpz at tuunq.com> wrote:  
 On 2/25/2018 12:38 AM, Kieran O Leary wrote:
> I have to do this on a regular basis at work and we use this script on
> pretty much a daily basis:
> https://github.com/kieranjol/IFIscripts/blob/master/bitc.py  - it works
> on windows, linux and OSX.

In a similar vein, I use tcl for this kind of scripting; highly portable 
when properly written and avoids most or all of the escaping problems of 
windows batch or *nix shell.

ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org

To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".  

More information about the ffmpeg-user mailing list