# Issue with command line export

**URL:** <https://forums.chaos.com/t/issue-with-command-line-export/111907>\
**Category:** Issues\
**Created:** [September 9, 2022, 8:07am UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907 "2022-09-09T08:07:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bf\_software](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bf_software/32/270_2.png) [@bf\_software](https://forums.chaos.com/u/bf_software)\
**Post date:** [September 9, 2022, 8:07am UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/1 "2022-09-09T08:07:51Z")

</div>

Hello,

We are trying to export a video via command line, “--save\_mask\_as\_sequence” , “--save\_mask\_as\_sequence=file.ext…” , “--save\_layer\_as” “--save\_layer\_as=file.ext…” do not initialize properly.

In this first example, we load a video, adjust exposure, saturation, contrast, and try to save\_frame\_as (the dialog should initialize?)  
“C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” “video.MP4” --exposure=0.8 --saturation=80 --contrast=0.2 --save\_layer\_as

second example where we give it a path string to save, but doesn’t starts to save  
“C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” “video.MP4” --exposure=0.8 --saturation=80 --contrast=0.2 --save\_layer\_as=“video\_post.MP4”

We have used “--layer\_select\_all” “--automatic\_preload=0” “--selected\_layer=1” for these examples thinking that the layer is not selected, or the preloading was creating an issue.  
None of the examples above would initialize the dialog window, this also holds true for using “--save\_mask\_as\_sequence” instead of “--save\_layer\_as”

More testing was done using the same from above string above but actually trying with  
“C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” “video.MP4” --exposure=0.8 --saturation=80 --contrast=0.2 --save\_frame\_as  
Which opens the save frame dialog window first then after saving or Canceling continues to load app with video, but also if you save it will only saves a black square 8x8 px, nothing from the loaded video/frame

And finally we split the inputs using --attach, first we load then we do save  
1. “C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” “video.MP4” --exposure=0.8 --saturation=80 --contrast=0.2 (to load video and adjust)  
2. “C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” -- attach --save\_mask\_as\_sequence (which opens the dialog window to save)  
but  
2a. “C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” -- attach --save\_mask\_as\_sequence=“video\_post.mp4” (doesn’t work)  
2b. “C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” -- attach --layer\_select\_all --save\_mask\_as\_sequence=“video\_post.mp4” (doesn’t work)  
2c. “C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” ---attach --layer\_select\_all --save\_mask\_as\_sequence=“video\_post.PNG” (creates layer with name of input “video\_post.PNG”) any image file name does this “.tif”, “.tga…”

What could be going wrong?

The version of the app is  
Version 2.00.22 build stable/2.0 29 2022

Thank you,

edit:  
“C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” “video.MP4” --save\_mask\_as\_sequence=“video\_post.PNG” (works)

---

<div class="post-metadata">

**Author:** ![yolov](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/yolov/32/11920_2.png) [@yolov](https://forums.chaos.com/u/yolov)\
**Post date:** [September 12, 2022, 12:12pm UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/2 "2022-09-12T12:12:58Z")

</div>

Hi there, sorry for not getting back to you earlier.  
Generally, --save\* should bring up the save dialog, and --save\*=“path/filename.ext” should directly save to this path.

It seems there’s some issues with saving from the command line, especially when writing to mp4. It does seem to work with PNG, so if that’s your target format, it should work for you.  
Just to make sure we’re talking about the same thing - when you use any of the flags that don’t work for you - does the running Player instance actually do anything?

---

<div class="post-metadata">

**Author:** ![bf\_software](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bf_software/32/270_2.png) [@bf\_software](https://forums.chaos.com/u/bf_software)\
**Post date:** [September 13, 2022, 8:25am UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/3 "2022-09-13T08:25:14Z")

</div>

Hello there,

Yes, we are unable to save from the command line using --save\_mask\_as\_sequence=path/filename.ext or --save\_layer\_as=path/filename.ext

running the player before the command line inputs, will open another instances of chaos player  
using --attach it will try to use the existing instance of chaos player, then it does loads/adjusts/selects and opens the dialog windows for --save\_mask\_as\_sequence, --save\_layer\_as

if chaos player already has video loaded then using --attach and --save\_mask\_as\_sequence=path/filename.ext or --save\_layer\_as=path/filename.ext does nothing if the .ext is mp4/MP4  
and  
--save\_mask\_as\_sequence=path/filename.PNG works, it starts to exports the video as PNG sequences

something to note  
“video.MP4” --exposure=0.8 --saturation=80 --contrast=0.2 --save\_frame\_as  
will start chaos player, open the dialog window to save frame first before anything else, after pressing cancel or saving the frame chaos player continues to load video and apply exposure/saturation/contrast

We assume that save\* functions are being called first, as in the case above the save\_frame\_as window opens, and when saving it saves a default 8x8 black image, this may affect also the other save\* modes.  
If true, then save\_mask\_as\_sequences cannot export anything as its called before the video is loaded.

We like chaos player, we would just like to save via command line for batching processing.

---

<div class="post-metadata">

**Author:** ![yolov](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/yolov/32/11920_2.png) [@yolov](https://forums.chaos.com/u/yolov)\
**Post date:** [September 16, 2022, 8:58am UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/4 "2022-09-16T08:58:33Z")

</div>

Hey @bf_software ,  
Just a note that we’re looking into this.  
Would you care to test an experimental build with a fix for this and let us know if it works better?

---

<div class="post-metadata">

**Author:** ![bf\_software](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bf_software/32/270_2.png) [@bf\_software](https://forums.chaos.com/u/bf_software)\
**Post date:** [September 16, 2022, 3:35pm UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/5 "2022-09-16T15:35:30Z")

</div>

We can save using the experimental version, much better indeed.  
Have noticed that preset/safe area was being used not sure if default in experimental versions, once we switch to preset layer it exported the whole video and not just 940px crop, is it possible to add --preset=whole/layer/none, and --quiet to ignore any message popups incase there will be any?

Going to experiment with some batching and see how it behaves

Thank you,

---

<div class="post-metadata">

**Author:** ![bf\_software](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bf_software/32/270_2.png) [@bf\_software](https://forums.chaos.com/u/bf_software)\
**Post date:** [September 20, 2022, 12:04pm UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/6 "2022-09-20T12:04:08Z")

</div>

Hello once more  
We’ve been working with the experimental version and discovered an interesting error

Start chaosplayer then “C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” --attach --exit  
Will throws 2 messagebox "Video files may be slow to playback… " and 2 errors with “Open error -2 (0xFFFFFFFFE)” and then closes.

Question:  
Will adding --exit process video then exit? or --exit supposed to be used with --attach --exit ?  
Ex:“C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” --exit --save\_mask\_as\_sequence=“video\_post.mp4”

Otherwise we will try with layer\_replace\_with, and loop over with attach instead of opening \> processing \> closing

Thank you,

---

<div class="post-metadata">

**Author:** ![yolov](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/yolov/32/11920_2.png) [@yolov](https://forums.chaos.com/u/yolov)\
**Post date:** [September 20, 2022, 2:28pm UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/7 "2022-09-20T14:28:18Z")

</div>

> [@bf\_software](#):
>
> We can save using the experimental version, much better indeed.

Good to hear. We’ll consider merging the changes to the builds and include the fix in the next release.

> [@bf\_software](#):
>
> Have noticed that preset/safe area was being used not sure if default in experimental versions, once we switch to preset layer it exported the whole video and not just 940px crop, is it possible to add --preset=whole/layer/none, and --quiet to ignore any message popups incase there will be any?

There aren’t any changes to the default mask resolution (it’s called mask resolution in player).  
Usually it keeps the value from the last session, so when working with different layer input resolutions you’ll need to adjust it. The “layer” preset is there for convenience just for such cases.  
Can you tell me more about what you expect to achieve with a preset=whole/layer in this case?  
Can you tell me more about what you expect to achieve with --quiet? Is there any particular issue that you’re facing?

---

<div class="post-metadata">

**Author:** ![yolov](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/yolov/32/11920_2.png) [@yolov](https://forums.chaos.com/u/yolov)\
**Post date:** [September 20, 2022, 2:37pm UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/8 "2022-09-20T14:37:04Z")

</div>

> [@bf\_software](#):
>
> Hello once more  
> We’ve been working with the experimental version and discovered an interesting error
> 
> Start chaosplayer then “C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” --attach --exit  
> Will throws 2 messagebox "Video files may be slow to playback… " and 2 errors with “Open error -2 (0xFFFFFFFFE)” and then closes.

This is actually what I came across when trying to replicate your original issue.  
I was hoping that the experimental build would fix that too, but it seems it still needs some work. We’ll try to fix that too.

> [@bf\_software](#):
>
> Question:  
> Will adding --exit process video then exit? or --exit supposed to be used with --attach --exit ?  
> Ex:“C:\Program Files\Chaos Group\Chaos Player\chaosplayer\_qt5.exe” --exit --save\_mask\_as\_sequence=“video\_post.mp4”

I’m not completely sure I understand the question, but --exit will generally close the Player. You can use it with or without --attach, depending on whether you want to launch a new instance or use a running one, and of course whether you want to exit at the end of your script.

> [@bf\_software](#):
>
> Otherwise we will try with layer\_replace\_with, and loop over with attach instead of opening \> processing \> closing

Can you tell me what the goal is here? Maybe you want to add one layer, process it, export it and then repeat the process for another layer?  
If that’s the case, you can try the --new\_composition flag. It will basically reset the existing Player instance (similar to New Scene or New Project in other applications).  
You can try it with something like this: load layer, process, export, new\_composition, load layer2, process, export, and so on.

Tip -you can add your commands in a text file and pass the path to the text file to player (with or without --attach), instead of passing a very long list of commands each time.  
The flag is:

```auto
--cmdfile=filename.txt

  Execute the commands from filename.txt​

```

As an example:

```auto

"C:\Program Files\Chaos Group\Chaos Player\chaosplayer_qt5.exe" --attach --cmdfile=C:\scripts\my_file.txt

```

Where my\_file.txt can have the long line and you can even use line breaks for better readability:

```auto
 "video.MP4"
-save_mask_as_sequence="video_post.PNG" 

```

---

<div class="post-metadata">

**Author:** ![yolov](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/yolov/32/11920_2.png) [@yolov](https://forums.chaos.com/u/yolov)\
**Post date:** [September 28, 2022, 7:42am UTC](https://forums.chaos.com/t/issue-with-command-line-export/111907/9 "2022-09-28T07:42:17Z")

</div>

We’ve added fixed for the pop-ups and they work internally. I’ve sent you a new build over DM. We’ll add the fix to the public builds once we make sure everything works as expected.
