Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Trying to get a Ubuntu Server of mine to transcode videos from 1080pHD mp4 to 720p ogg. I hired someone to set up PHP QB/AV (a dead project now) on the server and when I finally got around to testing it out it only seems to encode 1.3mb of video and then stops, no errors to found in the Apache logs, PHP Logs. Zilch.
So I'm rethinking my route and just gonna do plain old cron jobs, bash scripts and ffmpeg from the shell. Now I see that ffmpeg is no longer supported on Ubuntu until 15.04 release in the future, but I need something working now.
So I start reading up on ffmpeg and realize the devs hated each other or something the project has been forked off into libav. So let's keep this thread start short.
1. Do I want to install libav or ffmpeg?
2. How do I install it?
3. Some examples on how to use them.
Your help, massively appreciated. I Google'd and Google'd and found many docs on this, but they all seem to specific case scenarios for ffmpeg and I found nothing on installing and use libav to encode videos in a single command from the shell.
I think examples would depend on exactly what you want to do, I've cropped files, like a video of my dog had a coffee table at the bottom of it because the recorder was sitting on it, so I cropped it to get rid of a certain number of pixels from the bottom of the screen. I figured out the pixel count required to make it fit actually by using VLC and the advanced controls. So I'd also recommend using VLC to view and review. And of course do not specify actions to overwrite the original file, instead put it to another name and verify that you attained what you wished. Another thing one can do is choose the start and stop points so as to grab one scene out of a larger video, for instance the boring part where you hear me calling my dog to come and play and no visible action; I cut that out by specifying a later start time for the output stream. If you view help on either of those two applications, you'll see extensive information on the options and it really becomes a matter of what things you wish to do. I've never done much beyond resize, or limit, or convert from one known form to another one. Doing stuff like advanced filtering, mixing, or covering up stuff like how they cover a witnesses face by scrambling it, never done that.
A breakdown of what's happening: -i input.mp4: The name (or path of) the input file. As far as I am aware, ffmpeg automatically determines what the file type is, based on its contents. Fairly simple, right? -s hd720: The output video size. There are various presets built in, see the man page for a list. Alternatively, you can manually specify a width and a height. -acodec libvorbis: Specifies the codec to use for the audio. In my experience, for some reason ffmpeg wants to use its built-in FLAC encoder instead of the OGG Vorbis format. If you want to use FLAC, then just get rid of this part (although you have little to gain using FLAC, since the mp4 probably has lossy audio anyway). output.ogv: The output file. Usually, ffmpeg can determine the output codecs and formats based on the file extension. However, you can manually specify codecs to use (like what I did above with the audio).
Of course, these are just a few of the options available.
Last edited by maples; 03-24-2015 at 12:25 PM.
Reason: typo
Thanks for the replies guys. Unfortunately nothing is ever as simple as I hope it to be when it comes to Linux.
Code:
wh33t@ubuntu:~$ sudo apt-get install ffmpeg
[sudo] password for wh33t:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ffmpeg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'ffmpeg' has no installation candidate
wh33t@ubuntu:~$
So now I guess I'm installing it from source and compiling it?
So now I guess I'm installing it from source and compiling it?
No, not yet anyway.
I found this link: https://launchpad.net/~mc3man/+archi...u/trusty-media that has instructions on adding a PPA for ffmpeg. (I have no idea what a PPA is, I'm guessing that it's similar to a repository in Debian).
However, the page notes that you have to completely purge ffmpeg and the PPA if you want to upgrade to the next release of Ubuntu without reinstalling. Otherwise, it sounds like you could get stuck deep in dependency hell or at least have package conflicts.
as for the difference... I was reading in a blog post awhile back how the two have diverged yet are copying each others commits to their own. They're basically identical.
It's a odd situation for open source and a bit like if Apple and Microsoft open sourced everything and starting copying each other - and it's perfectly fine (at wasting time)
Was there a certain video codec you were trying to use? Ogg is a container and it can hold several types of audio/video. avconv is guessing the theora video codec based on your extension, but you could specify vp8 (I think avconv supports it).
As for the audio, converting from one lossy format to another is not going to get you high quality audio. You're starting with relatively low bitrate (~100 kbps) AAC and converting to vorbis - not ideal.
My 3 cents: nothing wrong with compiling from source. You can build ffmpeg with whatever codecs you want, and it will be optimized for your hardware too! Here's a guide to compiling ffmpeg with codecs of your choice on Ubuntu and friends.
Try using "-q:v 9"
If that gives an error, then it should be "-qscale 9"
(I'm not at a computer I can test it on, so I'm going off memory)
If I remember correctly, 9 is the hightest quality and 0 is the lowest.
And you should also be able to use "-q:a 9" for the highest quality audio, and "-q:a 0" for lowest quality.
Thanks, I managed to get it working. Going from 1080p mp4 to 720p ogg reduces filesize by 50%. That's not enough. What other options could I try here? How is it that movies on the torrent sites somehow cram 90 minutes of 720p video into 1.8gb?! That's the kind of compression I need, but is there any compression that good that will stream to an html5 compliant browser? Me thinks not but I await the answer with high hopes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.