Author |
Message |
rmcellig
Joined: 19 Nov 2011 Posts: 968 Location: Ottawa Ontario Canada
|
Posted: Wed 30 Jan 2013, 07:10 Post subject:
Using ffmpeg to extract snippets of video |
|
After trying Avidemux with mixed results, I am now deciding to try a command line alternative. This is totally new to me. Here is a brief summary of my workflow.
Locate and mark the beginning and end of a piece of video.
save the snippet
That's it. Can someone let me know what tools I need to accomplish this? I have been using mpeg streamclip on the Mac side and now I want to see if I can use ffmpeg to quickly automate the way I extract snippets of video in puppy Linux 5.2.8.
|
Back to top
|
|
 |
GustavoYz

Joined: 07 Jul 2010 Posts: 894 Location: .ar
|
Posted: Wed 30 Jan 2013, 10:56 Post subject:
|
|
Not sure if got the question, you mean extract just a part of a video? If so, I'd try something like this (example):
Code: | ffmpeg -i input.wmv -ss 60s -t 60s -acodec copy -vcodec copy output.wmv |
Which takes 60 seconds (-t), from the second nº60 (-ss), using the same codec settings for output file.
_________________

|
Back to top
|
|
 |
rmcellig
Joined: 19 Nov 2011 Posts: 968 Location: Ottawa Ontario Canada
|
Posted: Wed 30 Jan 2013, 11:25 Post subject:
|
|
Thanks for the reply. To be more specific, I need to extract snippets of video and save them to a new file. So for example in MPEG Stream clip on my Mac I put a marker at the beginning (00:2.34), and the ending (00:5:20). Once I do this, I save this to a new file and that's it.
Can I set the beginning and ending times above in ffmpeg, or do I always have to manually calculate the difference? If I am not making sense, please let me know. Being new to this I am just trying to wrap my head around how ffmpeg works. Once I understand it, I can more or less automate the process.
And finally, if I can nail down how to do this in Puppy Linux using ffmpeg and it works to my liking, it's good buy after over 25 years to using my Mac. For me, this would be a great milestone to celebrate!!
|
Back to top
|
|
 |
GustavoYz

Joined: 07 Jul 2010 Posts: 894 Location: .ar
|
Posted: Thu 31 Jan 2013, 11:54 Post subject:
|
|
I read the man page and did a quick google search about it, as I don't know any about ending points options, and found a big hole: seems that ffmpeg just doesn't have any. Guess that so far everybody calculated those...
Now I'm wondering, those marker positions are kept in the file's metadata or just belogs to the app? Could you try this?
Code: | ffmpeg -i yourfile.ext |
_________________

|
Back to top
|
|
 |
Semme

Joined: 07 Aug 2011 Posts: 7827 Location: World_Hub
|
Posted: Thu 31 Jan 2013, 12:12 Post subject:
|
|
Gustavo- this page is for YOU!
|
Back to top
|
|
 |
GustavoYz

Joined: 07 Jul 2010 Posts: 894 Location: .ar
|
Posted: Thu 31 Jan 2013, 13:00 Post subject:
|
|
Thanks, nice page also, but that's exactly what I was saying here before.
You can set offset starting time, then duration time, but you can't mark a begginning position in the "time line" and a final one: you can just mark the beginning and specify a duration. Thus, you can't do what rmcellig's request needs just with ffmpeg.
_________________

|
Back to top
|
|
 |
rmcellig
Joined: 19 Nov 2011 Posts: 968 Location: Ottawa Ontario Canada
|
Posted: Thu 31 Jan 2013, 13:20 Post subject:
|
|
Exactly. If there was a way to set the beginning and end points, that would make a ton of sense. What I have to do now is calculate the duration which to me doesn't make much sense. A start and end point seems more obvious. I'm going to probably look at something else. While I appreciate the power of ffmpeg, it doesn't seem to meet my needs which is unfortunate. I did download the Avidemux 2.6.1 debs and installed them (in an ubuntu distro but after all that, I can't find where to launch Avidemux.
So, for me, I haven't been very lucky trying to achieve something that I think is pretty basic, in Linux yet. This is the only thing that is holding me back from going 100% Linux. Maybe there is another command line tool or simple video editor for Linux that I am unaware of?
|
Back to top
|
|
 |
GustavoYz

Joined: 07 Jul 2010 Posts: 894 Location: .ar
|
Posted: Thu 31 Jan 2013, 15:58 Post subject:
|
|
Well, ffmpeg is a great command line tool and a terrific piece of software, but is way more common use durations than final positions, makes a lot of sense to me...
But anyway, if wont consider calculating, you should just try with some -others- video editors, as I don't think that the command line has more to offer than ffmpeg in any video-related issue (which is just my opinion).
I'd take a look at Open Shot and Cinelerra, there is a sfs with KdenLive somewhere too; just some options that came to my mind quickly.
Good luck.
_________________

|
Back to top
|
|
 |
rmcellig
Joined: 19 Nov 2011 Posts: 968 Location: Ottawa Ontario Canada
|
Posted: Thu 31 Jan 2013, 16:26 Post subject:
|
|
Thanks! I'll have to check out Openshot to see if you can mark the beginning and ending of a clip and then save it. If it can do this, I will be fine.
|
Back to top
|
|
 |
|