LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-03-2013, 07:53 AM   #1
BaptismOfFire
Member
 
Registered: Aug 2004
Posts: 107

Rep: Reputation: 15
Trimming H264 MP4's


A friend has supplied me with an entire season of one of my favourite programmes. Now I have already managed to successfully burn these to DVD to play back in the home (using WinBlows).

However, I notice a lengthy black screen at the add breaks.

I would like to trim out these black screens.

Optionally, for sake of completeness (OCD?), I would like to insert a splash screen. (I already have the clip to insert (a small part of the title sequence)).

So far I have tried AvidMux (Under Windows) and while it split, trimmed, inserted and joined the file(s), I was still left with the black screens.

I have just put together a new Debian system and planned on using it for my video needs as my Win7 craptop has seen better days (but is still needed).

So... bearing in mind I have little knowledge about video editing and formats, and have only just found out about I and B frames... What can you recommend?

What software (preferably free) will allow me to split, trim and join a H.264 MP4 quickly

Or am I seeking something that is not possible.

If the latter, what is the quickest and least lossy way to convert, split, trim, join and possibly re-convert before burning to DVD?

Thanks for your input.

(My current Linux system is very basic

Debian, XFCE, Thunar, XFBurn, Google Chrome (not Chromium), VLC and Bombono.

I am toying whether to keep VLC and Bombono or replace with MPlayer (+Mencoder) and DeVeDe.

I currently don't have FFMPEG, and really want to keep the system as light as possible - although K3B is calling. If I succumb to K3B, I might also choose a few other KDE apps.
 
Old 10-04-2013, 12:57 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
You can remove part of the video with ffmpeg or mencoder.
If you wanted to remove the last 30 seconds of a video that is 5 min long.
ffmpeg
Code:
ffmpeg -i video.avi -c:a copy -c:v copy -t 00:04:30 output.avi
mencoder
Code:
mencoder video.avi -oac copy -ovc copy -endpos 00:04:30 -o output.avi
Or remove the first 30 seconds.
Code:
ffmpeg -i video.avi -c:a copy -c:v copy -ss 00:00:30 output.avi
Code:
mencoder video.avi -oac copy -ovc copy -ss 00:00:30 -o output.avi
To join video's together, the files will need to be the same codec, size, bitrate...the same.
Code:
ffmpeg -i "concat:/path/to/file1.avi|/path/to/file2.avi" -c:a copy -c:v copy output.avi
Code:
mencoder file1.avi file2.avi -oac copy -ovc copy -o output.avi
The video that you want to insert needs to be the exact same bitrate, size, codec etc as the program video.

There are lots of threads on LQ and the internet on ffmpeg and mencoder usage.
http://linux.die.net/man/1/ffmpeg
http://ffmpeg.org/trac/ffmpeg/wiki/TitleIndex
http://linux.die.net/man/1/mencoder
 
2 members found this post helpful.
Old 10-04-2013, 07:01 PM   #3
Stealth Bot
LQ Newbie
 
Registered: Sep 2013
Distribution: Slackware 14 | NetBSD 5.1
Posts: 11

Rep: Reputation: Disabled
Quote:
Originally Posted by BaptismOfFire View Post
I currently don't have FFMPEG, and really want to keep the system as light as possible
You said you have a number of black screens throughout the videos. If so, you can use mplayer to edit out the points (i.e black screens) throughout the video(s). The option is -edlout.

Excert from man page for mplayer
Quote:
-edlout <filename>
Creates a new file and writes edit decision list (EDL) records to it.
During playback, the user hits 'i' to mark the start or end of a skip
block. This provides a starting point from which the user can fine-
tune EDL entries later. See http://www.mplayerhq.hu/DOCS/HTML/en/edl.html for details.
In plain english, for your situation. as you play the video, press the letter i at the start of a black screen and again at the end of a black screen. You repeat this process each time a black screen appears.

BTW, you don't need to watch the video at normal speed, you can skim fast forward or backward to search for black screens.

This is how you use the -edlout switch

Code:
mplayer video.mp4 -edlout editlist
The editllist could be any filename you want.

To test the edited points with mplayer. Type

Code:
mplayer video.mp4 -edl editlist
Note: Your original video file is still in tacked, nothing has been altered. Mplayer is just playing the video and skipping edited points from the editlist file.

After previewing it and if all black screens have been edited out, you can use mencoder to make a newly edited version of the video.

Code:
mencoder -o output.mp4 -ovc copy -oac faac  video.mp4 -edl editlist
Well that's it. I used this method when I want to edit out TV commercials.

Last edited by Stealth Bot; 10-04-2013 at 07:44 PM.
 
1 members found this post helpful.
  


Reply



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
Streaming mp4 (with h264) via Debain server with VLC shorto Linux - Server 1 09-20-2011 09:50 PM
converter for mp4, I-Pods and other portable mp4's ? stefan_rogin2000 Linux - Software 5 03-26-2008 02:43 AM
mplayer & h264 mp4 _slo Linux - Desktop 0 07-26-2007 03:01 PM
qestion about h264 to mp4 egad Linux - Software 0 04-30-2006 02:42 PM
Multiplexing mp3 and h264 in mp4 rcbaxter Linux - Software 1 03-05-2006 06:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:09 PM.

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