[Lazarus] Can I use fpc/Lazarus to edit mp4 files?

Bo Berglund bo.berglund at gmail.com
Thu Feb 28 10:56:43 CET 2019


On Thu, 28 Feb 2019 10:17:38 +0100, José Mejuto via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>El 28/02/2019 a las 10:12, Bo Berglund via lazarus escribió:
>> I am looking for a way to edit mp4 video files by cutting away parts
>> of the file.
>> So I am not looking for a way to view and edit the video visually,
>> rather a file cutting tool where I can use times into the video to cut
>> away parts between two timestamps.
>> 
>> Preferably as a command line utility that can be scripted.
>
>Hello,
>
>Just use ad-hoc tools like ffmpeg (I'm using it for everything 
>audio/video related) as its command line is powerful enough.

Thanks for the input!

Yes, I had googled for the function and thought about ffmpeg too but
when I located a stackoverflow post about cutting video it turns out
to work the opposite way!

https://stackoverflow.com/questions/18444194/cutting-the-videos-based-on-start-and-end-time-using-ffmpeg

Instead of cutting *away* the section it instead cut away everything
else leaving only the part that I wanted to remove...

I used this as a test to *remove* a section from 1:30 to 2:30 in the
video, but instead it extracted a 2:30 long part from the video
starting at 1:30...

ffmpeg -i testvideo.mp4 -ss 00:01:30 -t 00:02:30 -async 1 cut.mp4

Then I also used another command later in the post:

ffmpeg -ss 00:01:30 -i testvideo.mp4 -to 00:02:30 -c copy cut2.mp4

This created the same length output containing the same video section
but was MUCH faster...

But still it did not do what I want, instead it extracts into a new
video the part what I want to get rid of...

>If you have problems with it mail me private with expected result and 
>I'll try to give you a command line params to achieve it.

Thanks for the offer, but I don't know your email address (I am
interfacing with the mail list via GMane news gateway only)...

What I would like to do is to specify multiple cutaways in a file
based on time from the start so the process would be a one-time
operation where the final video does not contain any of the specified
video sections.

And I could probably use Lazarus to create a program enabling me to
specify the time sections and such and send a properly formatted
command line to ffmpeg...
(These cmd line utilities have such complex commands that one is prone
to forget between uses.)


-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list