Reputation: 11574
I'm processing user videos with differing aspect ratios. It seems FFMPEG only allows you to specify a fixed resolution. I want the output res to be appropriate for the input res. Similarly, I'd like FFMPEG to intelligently set the output bitrate based on the input video: obviously it shouldn't be any bigger than the input.
I can get the properties of a video with,
ffmpeg -i example.flv
But this requires some ugly parsing of the output, so I'm wondering if FFMPEG or some other tool has a more direct facility.
Basically, I have the Youtube problem: crap comes in, reasonably uniform quality should come out.
Upvotes: 7
Views: 4335
Reputation: 618
I know this is a very old question, but I'd like to add my 2 cents for what its worth.
Firstly, using ffmpeg
to get info on the video does give ugly output. Try using ffprobe
(bundled with ffmpeg
) instead. You can add options like -print_format json -pretty
to get nice JSON output of the information, which is much easier to parse.
Additionally, have a look at the following article: http://blog.superuser.com/2012/02/24/ffmpeg-the-ultimate-video-and-audio-manipulation-tool/ Its also a bit dated but should help as well.
Upvotes: 3
Reputation: 11574
Using a script seems like the right answer to the question I asked, but I should have mentioned that I'm using PandaStream. I was concerned because PandaStream has you specify a fixed output res, but apparently it has logic such that the input video gets bounded to this resolution, e.g. for the output res 480x270, a 4:3 video will be encoded at 360x270.
This seems like a good compromise. Just set Panda to output a 16:9 res and then 16:10 and 4:3 vids will come out fine for most purposes.
Upvotes: 1
Reputation: 2275
Someone named ahaslam may have already written a short bash script that addresses your problem.
Upvotes: 2
Reputation: 53310
ffmpeg
has an library interface - I know nothing about it, but maybe you could use that to get the information directly into your code?
http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html
Upvotes: 1