#__________________________________________diag_4_IAM_DM1+1_/20251202_______#
import time, subprocess
#___________________________________________________________________________#


path2ffmpeg = "L:/ffmpeg/"          ### folder wo ffmpeg.exe

path2images = "L:/animatzi/chanel/"
imgName     = "chanel_cam"
path4ani    = path2images           ### folder fuer animation - may differ from path2images

dimx = "960x540"
dimx = "1920x1080"
dimx = "1280x720"
fRate = 5
bRate = 8

#####################################
########## no changes from here on :)
aniName = imgName+"_"+dimx+"_fr_"+str(fRate)+"_br_"+str(1*bRate)+"_"+str(int(time.time()))+".mp4"
print "aniName:", aniName

imgName = imgName+"_%04d.jpg"       ### das %04d checkt die nummerierung der files / 4 = number of digits / check extention !
cmd = (path2ffmpeg+"ffmpeg -itsscale "+str(25/fRate)+" -i "+path2images+imgName+" -b:v "+str(bRate)+"M -c:a copy -c:v libx264  -pix_fmt yuv420p -vf scale="+dimx+",setsar=1/1 -r:v "+str(fRate)+" -y "+path4ani+aniName)
subprocess.Popen(cmd)
print "cmd:\n",cmd























'''
-y : no ask overwrite
-r : (frame)rate # fps, frames per second
-i : input
-b : bitrate .. b:v wie "video" 
     check filesize and -quality
-vcodec h264 (or libx264)
-vf scale=1920:1080,setsar=1:1 # frame size / https://ffmpeg.org/ffmpeg-all.html#setdar_002c-setsar
    no need to scale/resize if images are proper size :) .. 960/540 etc

concat:
    ffmpg -f concat -i list.txt -c copy output.mp4
'''
