I have a few thousand files from my conversion of Super 8 tapes to digital. The files are now presently all in M4V format. When the videos were shot, each clip in the video has a Fade In and a Fade Out applied. I want to trim the Fade In (0 to 6 seconds in every file) and the Fade Out (End-6 to End). I've looked into many options including searching on this forum, but just can't figure out what I need. I have access to both Mac and Windows, thus either option would work.
Thoughts?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 20 of 20
Thread
-
-
Probably easiest with ffmpeg
Code:for %%a in ("*.mv4") do ffmpeg -i "%%a" -ss 6 -vcodec copy -acodec copy "newfiles\%%~na.mp4"
But it's seems to be much more difficult to trim the end. See https://forum.videohelp.com/threads/348879-Trimming-video-from-it-s-end-using-FFMpeg-or-Mencoder
ffmpeg batch guide
https://forum.videohelp.com/threads/356314-How-to-batch-convert-multiplex-any-files-with-ffmpeg -
are you sure they are ".mv4", not ".m4v" ? It says mv4 in the title and the batch file, but the 1st post says M4V . Typo ?
add "pause" (without quotes) to the end of the batch file to see error messages -
add pause to the end of the bat file like
Code:for %%a in ("*.mv4") do ffmpeg -i "%%a" -ss 6 -vcodec copy -acodec copy "newfiles\%%~na.mp4" pause
and you will see the error message -
Then change to m4v
Code:for %%a in ("*.m4v") do ffmpeg -i "%%a" -ss 6 -vcodec copy -acodec copy "newfiles\%%~na.mp4" pause
-
Nothing is reencoded when you use -vcodec copy and -acodec copy.
mp4 = m4v. -
Based on what i have read, you have to use ffprobe to determine the duration. Then, subtract the end point from the duration to get the end point.
I tried this, but no dice.
for %%a in ("*.m4v") do ffmpeg -i "%%a" -t ffprobe "filename" -6 vcodec copy -acodec copy "newfiles\%%~na.mp4" -
It's complex. You should use ffprobe to read the length and then use it in the bat....I can try later tonight.
-
Any help you can lend is certainly appreciated. As you can imagine, I'm not even close to a coder. I'm just Googling and trying things to see what works.
I found this code that is supposed to give you the Duration in seconds. But I can't figure out how to get it into the BAT loop.
Code:$(ffprobe "$INPUT_FILE" 2>&1 | grep Duration: | \ cut -f3,4 -d: | cut -f1 -d,);
-
-
The other thing is...it doesn't have to be a trim. It could be a split of files 6 seconds from the end of each file. Then, I'll just delete the small files. Thoughts?
-
The effort is still appreciated!!!
I did find this code online for Mac. Problem is, it doesn't work under Mavericks. If there is anyone that knows anything about it...I'd love to figure this out!!!
Code:set secondsFromStart to 6 set secondsFromEnd to 6 set shortMoviesList to {} set srcFolder to choose folder tell application "Finder" set fileList to files of folder srcFolder repeatwith f in fileList tell application "QuickTime Player" open f tell document 1 -- Check to make sure we're not trimming more time than the movie contains set timeScale to timescale set trimmedTime to (timeScale * (secondsFromStart + secondsFromEnd)) if trimmedTime isgreater than duration then -- Not enough content to trim, add file name to a list setendof shortMoviesList to (the name of f as string) & return else -- We have enough content, proceed to trimming set selection start to (timeScale * secondsFromStart) set selection endto (duration - (timeScale * secondsFromEnd)) trim save endif close endtell endtell endrepeat if length of shortMoviesList isgreater than 0 then tell application "Finder" -- bring Finder to front so dialog is not hidden activate endtell display dialog "The following movies could not be trimmed because they do not contain enough content: " & return& return & shortMoviesList with icon caution endif endtell
-
OK, I got it. It only works on a Mac. And it only works with MP4 files. I struggled with this for the longest time. I kept receiving permission issues. Turns out, for some reason the Quicktime / Applescript would NOT work with an M4V. I converted my files to MP4 and voila, the code to trim works out perfectly. It is below.
Code:set secondsFromStart to 3.5 set secondsFromEnd to 3.5 set srcFolder to choose folder set dstFolder to choose folder with prompt "Choose the destination folder for the trimmed files." default location srcFolder tell application "Finder" set fileList to files of folder srcFolder end tell repeat with f in fileList tell application "QuickTime Player" open f set documentName to name of f delay (1.0) tell document 1 if duration > 7 then trim from secondsFromStart to (duration - secondsFromEnd) export in file ((dstFolder as text) & documentName) using settings preset "480p..." close saving no delay (1.0) else close saving no delay (1.0) end if end tell end tell end repeat
Similar Threads
-
Is there one free program to edit avi, mp4 and mkv and mv4 files ?
By Digmen1 in forum EditingReplies: 9Last Post: 2nd Apr 2013, 20:45 -
Need one app to trim, crop, menu, chapter and author to DVD... in batch!
By bhershey in forum Authoring (DVD)Replies: 4Last Post: 24th Mar 2011, 12:06 -
Batch trim a .MOV?
By romfre in forum Newbie / General discussionsReplies: 2Last Post: 20th May 2010, 06:21 -
suggestion for batch trim of AVI files under Windows please
By rjalex in forum EditingReplies: 0Last Post: 29th Jun 2009, 04:25 -
Hot to batch trim mpeg files
By brandox in forum Video ConversionReplies: 3Last Post: 6th Nov 2008, 13:17