Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-22-2009, 02:20 PM   #1
Registered: Apr 2004
Location: Leeds, UK
Distribution: FC1, FC2, Debian
Posts: 308

Rep: Reputation: 30
Programatically remove chunks from a video file?

I need to remove sections from video files (from the middle and the end) on the command-line. Generally these will be mp4 and avi files.

For instance, I have a .mp4 file which is 32:30 minutes long. I'd like to remove from 2:49 to 3:20, and remove the last 60 seconds.

Any ideas on how I can achieve this?
Old 10-22-2009, 06:34 PM   #2
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Jessie (Fluxbox WM)
Posts: 1,380
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
You can use mencoder for this. You can extract pieces from the file, eg:

mencoder input.mp4 -oac copy -ovc copy -ss 0 -endpos 169 -o piece1.mp4
mencoder input.mp4 -oac copy -ovc copy -ss 200 -endpos 1200 -o piece2.mp4
(-ss is the skip time, -endpos is the end point)

You can then use mencoder to join the result pieces together, eg:

mencoder piece1.mp4 piece2.mp4 -oac copy -ovc copy -o output.mp4
You can do the same thing with ffmpeg.

You could also consider using mpgtx.

the problem with google isn't the lack of useful results, it is just finding them amid all the flotsam.

Last edited by neonsignal; 10-22-2009 at 06:39 PM.


avi, mp4

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting chunks of data based on variables stored in another file (Perl?) mchriste Linux - Software 2 03-12-2009 12:44 PM
opening remove video file problem rbolt168 Linux - Networking 2 11-04-2006 07:50 PM
delete chunks or regions from text file - help K3vin Linux - Software 3 09-26-2005 02:57 AM
rute - in no chunks format? itsjustme Linux - General 1 04-18-2005 11:15 PM
Programatically downloading file. ugenn Linux - General 1 05-13-2002 09:57 AM

All times are GMT -5. The time now is 02:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration