Mar 14, 2019

Adding "Select Parent" command to Cinema 4D

1. Run the script manager, menu Script ➩ Script Manager
2. Choose Python (for C4D below R20)
3. Start new script, menu File ➩ New File
4. Paste the code into the code field
import c4d

def main():

    doc.StartUndo()
    s = doc.GetSelection()
    for x in s:
        try:
            p = x.GetUp()
            doc.AddUndo(c4d.UNDOTYPE_BITS, x)
            x.DelBit(c4d.BIT_ACTIVE)
            doc.AddUndo(c4d.UNDOTYPE_BITS, p)
            p.SetBit(c4d.BIT_ACTIVE)
        except:
            pass
    c4d.EventAdd()
    doc.EndUndo()
    
if __name__=='__main__':
    main()
as shown on the picture
5. You can render (current viewport) or load the icon for your script using File ➩ Render or File ➩ Load Icon
6. Save your new script File ➩ Save the script
7. Push the Shortcut button on the bottom right, assign your own key
8. Save your C4D config

You're done

Jan 13, 2019

Nudging a layer by a fraction of frame


When working with audio in After Effects I often find it difficult to sync the sound with a desired precision because all layers are snapped to frame length. But it's possible using AE scripting. You can save this as a separate script or (like me) use it with ft-Toolbar.
var comp = app.project.activeItem;
var lr = comp.selectedLayers[0];
if (comp.selectedLayers.length > 0) {
    var frl = comp.frameDuration;
    app.beginUndoGroup("Layer Nudge");
    lr.startTime += frl/4;
    app.endUndoGroup();
} else alert("Select a layer");
This code will nudge your selected layer by 1/4 of a frame length forward.
If you use ft-Toolbar (or similar extension) put the previous code as a main Javascript function. And for the modified (Ctrl +Click for instance) use the copy of it with a change of the sign in the line:
    lr.startTime -= frl/4;
It nudges the layer into the opposite direction. Or if you need a different precision, just change the divider /4.

Happy aftereffecting :)

Oct 24, 2018

Moved my tools to Github

I won't post updates on my SendTo_FFmpeg batches here anymore. I moved it all to a Github repoSo if you have issues, ideas, request, post them there.
There's also new AEExprTool I develop for myself. It's After Effects script for adding/removing error handling code in AE expressions in bulk. It's already a huge time saver for me. Would love to have some feedback cause I plan to make it a reliable full featured tool.

Oct 5, 2018

TIME TO PAY ATTENTION TO YOUR CYBER SECURITY...

... or just 3 apps to keep you out of troubles.

Start with a simple thing - a password manager right NOW. It will take some time and effort but it will keep you safe of potential troubles/damage/losses. Those risks are constantly growing, you have to be prepared! 

You MUST keep your passwords very COMPLEX (12 - 20 random symbols in length) and UNIQUE for each single service (any one can be hacked and leak your data). You can't just keep those in your head or on a paper. You need a manager with just one MASTER password you have to remember (no paper!)
I've been using password managers for years now. So my experience is at your service in this post.



Aug 27, 2018

C4D, Redshift, Relighting and the Normals

Recently met the task of relighting in post and had a range of troubles trying to make it in After Effects. I do not recommend anyone doing it in AE :).
The free Normality plugin is barely compatible with the modern CC versions and produces crazy burnt highlight values and dirty edges (at least that was my experience of using it with AE CC2017). There's a better and payed alternative like Pixel Cloud now although dealing with all the required passes is not an easy task for starters.
Oh, the main reason for this post was actually just leaving a memo for any one who cares including myself. It's about C4D's standard renderers' normal pass specs that I've managed to match during the work/tests. Since I am a dedicated Redshift user I was able to identify that C4D's normal pass is a Camera space normals of unsigned values of 0 .. 1. Redshift by default operates on signed -1..1 values. So to get the equal normal pass from the Redshift you need something like this

With the RS State node set to Camera transform space.

Aug 1, 2018

SendTo FFMpeg batches updated with encoding using external audio file

Heres a new batch in my collection
@ECHO OFF
ECHO [----------------------------------------------------------------]
ECHO [---  SendTo FFmpeg encoder v1.01 by Keerah.com               ---]
ECHO [---  MP4 h264 module has been invoked                        ---]
ECHO [---  Preset: CUDA 420, Slow, 40Mbit, External Audio to AAC   ---]
ECHO [---  Using external audio source file: %~n1.wav
IF %1.==. (
ECHO [----------------------------------------------------------------]
ECHO [     NO FILE SPECIFIED                                          ]
) ELSE (
IF not EXIST %~n1.wav (
ECHO [----------------------------------------------------------------]
ECHO [     Couldn't find the external audio file: %~n1.wav
GOTO End
)
ECHO [----------------------------------------------------------------]
ECHO [     Transcoding...                                             ]
"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -vsync 0 -hwaccel cuvid -i %1 -i %~n1.wav -c:a aac -b:a 256k -shortest -c:v h264_nvenc -preset slow -b:v 40M -pix_fmt yuv420p -force_key_frames 0:00:02 -y %1_cuda420_40Mbit_slow_ext.mp4
)
:End
ECHO [----------------------------------------------------------------]
ECHO [     SERVED                                                     ]
ECHO [----------------------------------------------------------------]
PAUSE
This one uses your Cuda card for encoding (to yuv420 40Mbit mp4) but also looks for a .wav file with the same name as your source video has and places it instead of whatever audio was in your source video. If the streams are different in length the arg -shortest tells FFmpeg to cut the output to the shortest of audio or video. New audio will be recompressed into 256kbps AAC, FFmpeg is clever and takes in account all the source audio channels.

Your source video and audio files must have exact names (except the extension of course). The script checks if there's appropriate .wav file found and stops in case it wasn't.

All presets are now yuv420 (12bit per pixel) to achieve better compression, use -pix_fmt yuv444p  for higher quality you444 (24 bit per pixel) output.

Jul 28, 2018

SendTo FFmpeg batches updated with Cuda presets

Transcode now even faster.
I've just added 2 new presets to encode into h264 using Cuda, for me on GTX1080 it's up to 10 times faster than on CPU. I've also added a small text description file to the archive so it'd be easier for you to use them. You need an Nvidia card for this to work of course, and it must be Pascal or newer. There's also some restrictions on input video parameters which won't let you use Cuda encoding (over 4K resolutions and some kinky pixel formats for instance).

The example batch for Cuda enabled encoding looks like this
@ECHO OFF
ECHO [----------------------------------------------------------------]
ECHO [---  SendTo FFmpeg encoder v1.01 by Keerah.com               ---]
ECHO [---  MP4 h264 module has been invoked                        ---]
ECHO [---  Preset: CUDA 444, Slow, bitrate 20Mbit, Audio Copy      ---]
IF %1.==. (
ECHO [----------------------------------------------------------------]
ECHO [     NO FILE SPECIFIED                                          ]
) ELSE (
ECHO [----------------------------------------------------------------]
ECHO [     Transcoding...                                             ]
"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -vsync 0 -hwaccel cuvid -i %1 -c:v h264_nvenc -preset slow -b:v 20M -pix_fmt yuv444p -c:a copy -y %1_422_20Mbit_slow_cuda.mp4
)
ECHO [----------------------------------------------------------------]
ECHO [     SERVED                                                     ]
ECHO [----------------------------------------------------------------]
PAUSE
As you can see it uses a separate Nvidia codec h264_nvenc. For more information on the codec and its parameters refer to Nvidia's application note. Just one hint from me on -b:v 20M argument, which defines the bitrate for the output.

Jul 10, 2018

How to add comment field to any windows Folder

I think it can be really useful in your workflow to have a comment field for your folders.
So I searched for simple way of adding a comment without using any additional software.


1. Right-click the folder and select Properties.

2. From the Properties dialog box, select the Customise tab, and then click the Change Icon button.

3. In the Change Icon dialog box, select an icon from the selections and click OK. Click OK to close the Properties dialog box. If you'd like to keep the normal folder icon, you can simply choose it from the selection when changing the icon, it is the exact same.

4. Open the folder, locate the Desktop.ini file, and double-click it (its a hidden file, you need to enable its visibility in explorer or enter its name directly). Add new line InfoTip= under the [.ShellClassInfo] section and type your detailed description immediately after the = sign. Go to File -> Save and close Notepad.

You'll see your detailed pop-up description the next time you hover the mouse over that specific folder or when you enable Comment field displayed in your explorer windows.

Updated version of GIF batch with multiple file support

Last time I've posted a batch for encoding your files into high quality GIFs, fast and free using FFmpeg. Although you can send multiple files one by one to parallel batch processes, some peeps don't want those clicks and asked me to make a version with multiple file support. Here it is. You can submit a ton of files with 1 click and go eat your pizza while it's being encoded.
@ECHO OFF
setlocal enabledelayedexpansion
set argCount=0
for %%x in (%*) do (
   set /A argCount+=1
   set "argVec[!argCount!]=%%~x"
)
ECHO [----------------------------------------------------------------]
ECHO [---  SendTo FFmpeg encoder v1.1 by Keerah.com                ---]
ECHO [---  Multi GIF module has been invoked                       ---]
IF %argCount% == 0 (
ECHO [----------------------------------------------------------------]
ECHO [     NO FILE SPECIFIED                                          ]
GOTO End
)
IF %argCount% GTR 1 (
ECHO [----------------------------------------------------------------]
ECHO [     %argCount% files queued to encode
)
FOR /L %%i IN (1,1,%argCount%) DO (
ECHO [----------------------------------------------------------------]
ECHO [     Encoding file %%i of %argCount%
ECHO [     STAGE 1: Generating a palette                              ]
"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -v warning -i !argVec[%%i]! -vf fps=15,scale=320:-1:flags=lanczos,palettegen -y !argVec[%%i]!_palette.png
ECHO [----------------------------------------------------------------]
ECHO [     Encoding file %%i of %argCount%
ECHO [     STAGE 2: Encoding to Gif using the generatied palette      ]
"c:\Program Files\ffmpeg\bin\ffmpeg.exe" -v warning -i !argVec[%%i]! -i !argVec[%%i]!_palette.png -filter_complex "fps=15,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" -y !argVec[%%i]!_hqgif.gif
IF EXIST !argVec[%%i]!_palette.png DEL /s !argVec[%%i]!_palette.png > nul
)
:End
ECHO [----------------------------------------------------------------]
ECHO [     SERVED                                                     ]
ECHO [----------------------------------------------------------------]
PAUSE

To make your work even more easier I share my own presets.
The archive contains a few presets and .lnk files (which you need to modify in case you use them). I will be continuously updating them. For now just this version supports multiple files encoding, I'll fix it soon for other batches.

And by the way, you don't really have to use it with SendTo menu as I described before, you can just drag and drop your video files over the .bat file icon. Any way convenient to you.

Cheers