Cutting front and end credits with Avidemux batch

Started by flash_22, July 09, 2016, 01:54:12 PM

Previous topic - Next topic

flash_22

Hi,
I got many recorded TV-Episodes which have got a constant (duration) front credit "a" and a constant (duration) end credit "b". Is there a way to cut off e.g. 20 seconds from the beginning and e.g. 30 seconds from the end per Avidemux batch?

Thanks for your help!!

Greetings, flash_22

Jan Gruuthuse

#1
If these are recent HD recordings, most likely not (2.6 processing)
If these open correctly with 2.5.6, maybe.
Still problematic most likely not all recordings are in exact time frame (tv transmissions have a tendency to start later or earlier)

Checkout this youtube video: Fast Edit with Copy Mode on our youtube channel: Avidemux Demo

should be very straightforward, you could make a tinypy script to mark
- the 1st 20 seconds (lead in)
adm.clearSegments()
adm.addSegment(0, 0, 3596750022)
adm.markerA = 0
adm.markerB = 20470022


- the last 30 seconds (lead out)
adm.clearSegments()
adm.addSegment(0, 0, 3596750022)
adm.markerA = 3565590022
adm.markerB = 3596030022


and call these from menu Custom

Then select precise cutting point with keyboard up/down arrows

in each script you would delete the reference to the loaded video, but leave the marker settings

don't know if the time gain would be greater the if you would do this manually. I do this manually 10 to 20 videos / time (mostly/day). Is boring job.

see additional menu Custom info here: Custom Menu and Saved projects

ps. don't use these examples, they wont match with your recordings.

EEMcGee

#2
If you are recoding at the same time just open one of the video files, set the markers, set your audio tracks, set your video and audio recode settings, then save it as a project.  Open the project file in a text editor and get rid of the video file open information.  Then save it again making sure it is saved with the .py extension.
Open a text editor and copy this in.

set avidemux="C:\Program Files\Avidemux 2.6 - 64 bits\avidemux.exe"
for /R %%f in (*.avi) do if not exist %%f.mp4 %avidemux% --load "%%F" --run "Your Project File.py" --save "%%~dpF%%~nF.mp4" --quit

This is if you were opening AVI files and recoding to MP4 files.  The "Your Project File.py" would be whatever you named the project as.  It will also check to make sure you haven't already processed the AVI file into an MP4 and skip it if you have.  That way if you haven't deleted an AVI that you already processed it won't recode it again.  It will save the recoded MP4 file to the same directory with the same name as the original only as an MP4.  Save the file with a .bat extension.

Now put both the .py file and .bat file into the folder your video files are in and double click the .bat file.  When all is done just select all of the original video files and delete.  You can always throw more files in and run the .bat again to process the new ones.



If your not recoding at the same time (saving video in copy mode) there would be a problem as your not always going to have the marker set on an I-frame.  Each video will have I-frames at different points in time from the others.   You could potentially do it with a script (not a project file) that would go to a point in time then go to the next Intra frame. or next black frame then next Intra frame if you set it a little before the known cut point so it would find the black frame between scenes if there is one then cut at next I-Frame .  I don't know enough about the scripting to tell you how but think you can probably access those commands.