I have several hundred one minute long mp4 files that I would like to split/crop to make them 30 seconds long (or perhaps less) without re-encoding.
I've spent hours looking for software that can do this without any luck.
*Is* there software that can do this? I have no experience writing scripts, so I'd prefer something with a GUI.
Any ideas?
+ Reply to Thread
Results 1 to 15 of 15
-
-
I was afraid of that. But if it isn't too difficult, I'll give it a shot.
I'd like to keep the last 30 seconds (possibly 20) of each file. If splitting every file in half (and then deleting the first half) is easier, I have no problem with that either.
Thanks so much for your help. -
Usually keeping the end is problematic to do in a batch script (it's easier to keep the beginning), but if all the files are approx 1min each, you can set the start time to 30 sec and it will copy from 30 sec to end, giving you the last 30 sec if they are 1min in duration. These will just be approximate times (you can't split precisely with most compression schemes anyways, because of long GOP encoding - you can only cut on keyframe boundaries, unless you use "smart editing" software which re-encodes a few frame around the cutsite, but you lose quality on those frames. With this method, there is no quality loss, but the cuts will not be precise, just approximate)
1) To do this with ffmpeg, you download ffmpeg, and it's easier to place a copy of ffmpeg.exe in the same directory as files to be copied if you're not familar with paths or environment variables
2) Open a file in notepad, in the same directory, copy & paste the following, save it, then rename the extention from .txt to .bat (e.g. it might be "batch.txt" to "batch.bat"
Code:for %%a in ("*.mp4") do ffmpeg -i "%%a" -c:v copy -c:a copy -ss 00:00:30 "%%~na.cut.mp4" pause
The original files won't be overwritten. Each will be stream copied (audio & video only, not accessory streams, like subtitles because you never mentioned that) and have "cut" appended
e.g
file1.mp4 will produce file1.cut.mp4
file7.mp4 will produce file7.cut.mp4
.
.
.
Try it out on a few test files first before committing to the large batch -
Tencoder is exactly what I was looking for other than one critical problem: Each file has to be trimmed manually. Thanks for the suggestion.
poisondeathray, your script works beautifully. Is there a parameter that can be added to keep the timestamp the same as the original file?
Thanks again for the help. -
Is there a parameter that can be added to keep the timestamp the same as the original file?
-
Meaning I'd like the newly trimmed files to keep their original Date Created.
-
Not possible with ffmpeg, because it cannot do "in-place editing" when used in this fashion - ie. it's non destructive (original file isn't over written) . It has to stream copy (write) a new file, thus a new date created on the new file
There are other utilities to patch the date created/ date modified etc... and fill in various other fields, but I haven't really used them. There are some threads at videohelp about that. So you might be able to do a 2step batch, 1st to stream copy with ffmpeg, then the other utility to patch the date -
Great, I'll look into that.
Thanks for everything. It was exactly what I was looking for. -
Try adding the start time of 30 sec
--ss 00:00:30
To re-iterate, this only works because your files are about 1 min long. If they were variable in length, some hour long, some 30 min, etc.... this wouldn't work -
Fleat, Did you find a way to keep created date? I wrote a short GUI a while back that does a folder full and altered it to match files with added text like PoisonDeathRay suggested. You did mean Windows created date or di you mean the Medi Info information?
PHP Code:General
Complete name : C:\Users\Bud\Desktop\Mia_all.wmv
Format : Windows Media
File size : 93.0 MiB
Duration : 18mn 41s
Overall bit rate mode : Constant
Overall bit rate : 696 Kbps
Maximum Overall bit rate : 700 Kbps
Encoded date : UTC 2005-05-05 12:03:21.265
The original files won't be overwritten. Each will be stream copied (audio & video only, not accessory streams, like subtitles because you never mentioned that) and have "cut" appended
Just wondering and the last accessed is being a bear to change since Microsoft's last update to Microsoft Studios.
Similar Threads
-
Batch embed .SRT files in MP4 container
By baglio in forum MacReplies: 12Last Post: 23rd Dec 2017, 03:24 -
What program can batch convert JUST audio of .mp4 files then re-mux?
By Whitezombie455 in forum Video ConversionReplies: 18Last Post: 25th Jan 2015, 09:36 -
Batch muxing and demuxing mp4 files
By Island_Dweller in forum Video ConversionReplies: 3Last Post: 17th Aug 2014, 10:58 -
Batch Convert .MTS files to .MP4?
By rocketman778 in forum Video ConversionReplies: 13Last Post: 1st Aug 2014, 06:56 -
Problem with splitting MP4 files
By mike70 in forum Newbie / General discussionsReplies: 3Last Post: 25th Oct 2013, 06:50