Skip to main content
Inspiring
May 24, 2017
Question

system.callSystem() on Mac and ffmpeg

  • May 24, 2017
  • 4 replies
  • 4341 views

Hi,

I've been working a few hours on this with no luck, maybe anyone here can help:

I have an issue on Mac with a script where I want to transcode some files using ffmpeg.

Here's what's going on:

var cmd = pathToFFMpegBin + '/ffmpeg -h';

var output = system.callSystem(cmd);

alert(output);

This works well, the command is executed and the alert shows the help for ffmpeg

But with the full command line to encode a file, like:

var cmd = pathToFFMpegBin + "/ffmpeg -h -i " + inputFilePath + " -c pcm_f32le " + outputFilePath;

var output = system.callSystem(cmd);

alert(output);

After Effects freezes (with the mouse cursor being the waiting cursor) like it's stuck in an endless loop

The alert is not shown, the script is stuck at the callSystem line.

BUT: the encoding does work, the new file is created and working...

- The same command works well in a terminal or as a bash script.

- The script works well in Windows

- If I provide a invalid path to the input file or the output file, it works as expected (the alert shows the error returned by ffmpeg)

- If I set ffmpeg to quiet mode (using the '-v quiet' option), it still don't work.

- I tried creating and executing a bash script, but I can't use File.execute() as it opens the script in a editor (even after I have set it to executable, that's normal behavior on Mac). I have to execute it via a callSystem('./file') and this freezes After Effects too.

- I tried launching the script via ExtendScript toolkit, both After Effecst and ExtendScript toolkit freeze, and I cannot stop the script in ES Toolkit.

- Tested on CC2017 and CC2015, same result.

- Javascript debugging is enabled, but I don't have any debug info, it's really like the script is in an endless loop, except I can't stop it.

Any idea? Or do you think about a workaround?

Oh and the ffmpeg binary was the snapshot build here: wihttps://evermeet.cx/ffmpeg/ the one recommended by the official ffmpeg website.

I still have to test with another version.

This topic has been closed for replies.

4 replies

Participating Frequently
April 12, 2024

This "bug" remains in 2024.....

Participating Frequently
April 12, 2024

Inovking `system.callSystem` on my M3 Macbook Pro will freeze After Effects. But it will not with the same code on a Intel chip Macbook Pro.

Participating Frequently
April 13, 2024

This bug was gone after AE automatically upgrade to 24.3 yesterday...

Alexandre Parenteau
Adobe Employee
Adobe Employee
August 2, 2017

I think the fix is in the latest AE. Hopefully someone here will be able to confirm!

Legend
July 24, 2018

Was this fix ever confirmed in the subsequent release of AE?  I’m getting a similar error, but with calling NodeJS script

Alexandre Parenteau
Adobe Employee
Adobe Employee
May 25, 2017

Nice to know there is a work around!

Looking at AE code, indeed there is a problem on Mac.

Would it be useful to include a fix for this problem in the next release? With the fix, AE will wait for ffmpeg to complete, so need to mock with '&'.

It will look like this:

UQg
Legend
May 25, 2017

CC 2018 ? o_o

Alexandre Parenteau
Adobe Employee
Adobe Employee
May 25, 2017

I meant in a 2017 dot release. Please vote up, if interested.

Mathias Moehl
Community Expert
Community Expert
May 24, 2017

Just a hack, but since it looks like Ae does not notice properly when the command terminated, maybe just append a "&" at the end of the command line call such that it terminates immediately and does not wait until ffmpeg is finished.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
nicoDudufAuthor
Inspiring
May 24, 2017

Hi Mathias!

Thanks! That will do the trick for now
I wish I'd knew Mac OS better....

But, this can only be a temporary hack, as using this there's no proper way to know when the encoding is finished, am I right?

Mathias Moehl
Community Expert
Community Expert
May 24, 2017

Yes, this is the disadvantage of this approach. In case the ffmpeg command produces some text output when it is finished, you could try

/ffmpeg ...yourparameters...  > result.txt &

which will write the text output of the ffmpeg call to the file result.txt

Then you can let the aescript run in an endless loop (maybe with some kind of timeout) waiting until the file result.txt exists and then check whether it contains the expected output. But again, it is just a hack.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects