[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the exact same batch cut or operation on multiple files #868

Open
8 tasks
mifi opened this issue Sep 23, 2021 · 1 comment
Open
8 tasks

Run the exact same batch cut or operation on multiple files #868

mifi opened this issue Sep 23, 2021 · 1 comment

Comments

@mifi
Copy link
Owner
mifi commented Sep 23, 2021

NOTE: This is different from #89, because that is just a workflow improvement.

This feature is about running the exact same operation (or cut) on multiple files, e.g. you have a folder with a number of files, and you want to do the exact same thing with all files.

Such a feature could be implemented by having an extra "Tools" menu or an option in the Export dialog where the user selects additional files to run the same edit on. Or the operation could be done on all files the currently loaded batch list.

Note that I haven't prioritised this very highly, because there are so many different wishes and these kinds of operations can often be easily automated by bash scripting using ffmpeg directly (even with the help of AI, see workaround below).

Batch same cut on multiple files

This might done on be all files in the "batch list".

Other batch operations

Grouped batching

Workaround: bash script

A simple workaround is to write a bash script and use ffmpeg directly. For example to cut multiple files exactly the same, create a file batch.sh with this content:

# example: cut away 30 sec from start of all files, and include everything until 60 sec
# adjust the following values:
TIME_TO_CUT_FROM=30
TIME_TO_CUT_TO=60
FOLDER_PATH=/path/to/files/*.mp4

for FILE in "$FOLDER_PATH"
do
  # This ffmpeg command can be replaced with whichever operation you'd like to run on all the files.
  # It could also be an ffmpeg command copy-pasted from LosslessCut (and adjusted)
  ffmpeg -ss "$TIME_TO_CUT_FROM" -i "$FILE" -t "$TIME_TO_CUT_TO" -c copy "$FILE-cut.mp4"
done

Note that the example script above is for UNIX based operating systems like MacOS/Linux. Windows users: If you need to do this on Windows, maybe you can ask ChatGPT something like: "Convert this command from bash to Windows Batch" and paste the above command. Or you can use WSL2.

Tip: First run your desired operation (e.g. a cut) in LosslessCut on your first file in your batch list. Then open then "Last ffmpeg commands" menu, and look at the last ffmpeg command that was run. Then copy this and paste it into the above script. You then need to insert variables like $TIME_TO_CUT_FROM, $TIME_TO_CUT_TO and $FILE into the command you copy pasted.

Bonus: ChatGPT / AI

I wish more people were aware of this, but large language models like ChatGPT can be incredibly useful for helping non-programmers with simple programming tasks.

Basically you just need to ask the AI to write a script for you to do whatever you need. If it doesn't work, you can continue the conversation to try to get it corrected. And it's free!

Here are a few examples:

Batch split files into equal length segments

write a bash script that takes a folder of mp4 files, then for each file, split it into an (unknown) number of files, each file of an equal length of 299 seconds.

This gave me the following script: #2011 (comment)

Batch rotate all files to 90 degrees

write a bash script that takes a folder of mp4 files, then for each file, losslessly change the rotation to 90 degrees and output to the same folder.

You know the drill now...

Then once you have the script, you can ask ChatGPT "how do I run this?"

@mifi mifi changed the title Run the exact same batch cut on multiple files Run the exact same batch cut or operation on multiple files Jan 15, 2022
@mcp73
Copy link
mcp73 commented Feb 18, 2023

As others have already requested...

I have a directory full of files with the exact same intro and tail i'd like to trim off (same cuts). The files also require 'fix incorrect duration' and export to the same format. Processing in batch overnight would save a huge amount of time.

Thanks for counting my vote for this capability.

mifi added a commit that referenced this issue Oct 15, 2023
- add closeCurrentFile action
- allow export confirm also via action
- upgrade electron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants