Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

I'm thinking of extracting the "best" parts of my home video files. Why? Because my videos has a lot uninteresting footage that I don't need wasting disk space.

I thought I'd use -ss and -t to specify the part I want, and -codec copy. Example:

ffmpeg -i iphone4sFullVideo.mov -ss 00:00:10 -t 10 -codec copy iphone4sGoodPart.mp4

I have of course tested this and know this creates a new file with a length of 10 seconds that plays in vlc.

With doing this I think I am getting no loss in quality, and being able to use the mp4-video in a GUI video editor (like Adobe Premiere Elements) later. I was planning to do this with my video files from different phones and camcorders. I got .mts, .mov and .mp4.

My question is kind of advice seeking. Is what I'm thinking of stupid? Will my files be ok after copying a part to an mp4 container?

share|improve this question

marked as duplicate by ChrisF, Ƭᴇcʜιᴇ007, Tog, Mokubai, Shekhar Oct 10 '13 at 15:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
it's wise to seek advice before it goes wrong, I just hope you'll be so lucky as to get advice on that matter. not many people understand ffmpeg, @slhck does but I doubt many others do here. I certainly don't! Your -ss and -t are in the right place for accuracy. If you put them before the -i you'd have less accuracy but a quicker execution. He mentions that here blog.superuser.com/2012/02/24/… personally I avoid ffmpeg and use xilinix (payware) but it works nicely and has amazing support and is very usable for me! –  barlop Oct 8 '13 at 20:19
1  
It's pretty unclear what you're asking, did you want to clarify it a bit more? I say this as Is this a wise thing to do? Any suggestions? is all sort of opinion based, also there are 2 f's in ffmpeg –  50-3 Oct 8 '13 at 20:20
    
@50-3 He put two fs in ffmpeg in his title and the tag so obviously he made a brief typo in his command but that's irrelevant. It's a great question 'cos you can run into issues,which u should know if you've ever been to hell and back using ffmpeg.U could try to combine an mp3 and get the wrong duration reported.U could use the wrong codec n not get good support in applications that run the file later.And just see my comment,pointing that he got -ss and -t RIGHT,but it's easy to put it before and lose accuracy, so sure there are things to get right in using it that one might not know about. –  barlop Oct 8 '13 at 20:23
    
Exactly what do you mean "Is it wise"? Why do you think it isn't? What happens when you try it? You can backup the video file and then try things you know. ;) –  Ƭᴇcʜιᴇ007 Oct 8 '13 at 20:24
1  
Still a lack of research effort shown (IMO), and not really an actual problem presented. My thinking: Try it, did it work? Yes: done, No: post question explaining what the problem is, what was tried already, and what the results were. His command line was also presented as an "example" not the actual command/arguments he wants to use. But whatever. ;) –  Ƭᴇcʜιᴇ007 Oct 8 '13 at 20:27

1 Answer 1

up vote 1 down vote accepted

I was hoping somebody with more expertise than I, could reply, but sadly I may be your best option at the moment!

Checking an old note, no the command you've done is not wise. Because the codecs are different for different container formats.

Use mediainfo to check the container and video and audio codec in the output file. You want (of) these for mp4.

MPEG4 
   Video codecs   x264, xvid, libavcodec, divx
   Audio codecs  aac,mp3

apparently x264 is a good one for video.

-vcodec libx264

these should be useful for acodec

-acodec libmp3lame   or  -acodec libfaac

ffmpeg documentation says- Regarding -codec copy, (and no doubt this applies to -acodec copy or -c:a copy, or -vcodec copy or -c:v copy)

"Since there is no decoding or encoding, it is very fast and there is no quality loss. However, it might not work in some cases because of many factors. Applying filters is obviously also impossible, since filters work on uncompressed data."

So you need to specify the correct video and audio codecs.

you can check them with mediainfo.exe from mediaarena.net very easy for a techie to use e.g. C:\>mediainfo a.mp4

share|improve this answer
1  
Thanks, I'll take your advice and look further into encoding with a specified codec. I have used exiftool, but I'll look into mediainfo as well. –  jostyposty Oct 9 '13 at 16:35
1  
@LordNeckbeard while it was ok for my iPhone video, I'm not sure it will work for all my videos. I was sort of hoping for a simple solution to "fit them all", but it is now obvious I need to research this way more. –  jostyposty Oct 9 '13 at 16:36
1  
@barlop My command had some problems regarding IDR, as I understood. The screen was black until next IDR frame was reached, or something. I fixed that with moving the seek (-ss) part before -i, but still got the problem on the end of the video. With your command the video played without problems. One thing I have to investigate more, is sizes. My command: 25 MB, your command 8 MB. Am I loosing quality? –  jostyposty Oct 10 '13 at 10:40
1  
@barlop It works after -i yes. So that is great. Both are video h264, yuv420p, but the difference in bit rate is 21203 kb/s versus 6663 kb/s. Quite big, is it not? I'am thinking of looking further into two pass encoding as well. Encoding time is not an issue, so I thought I'd try to get the best quality I can. Thanks for the guiding. I have some reading to do. –  jostyposty Oct 10 '13 at 18:39
1  
@barlop this is kind of embarrassing, but I don't have enough reputation to be in the chat jet. Kind of new here at superuser. –  jostyposty Oct 10 '13 at 20:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.