The iPhone app I am working on captures images in series within certain user-defined time interval, I am looking for a way to combine these images into H264 encoded videos. I have done some research on Google, it looks like I will have to use something like ffmpeg/mencoder on iPhone? (Also found someone ported ffmpeg to iPhone, ffmpeg4iPhone)
However, I found that x264 is under GPL license, and requires me to open source my project if I use ffmpeg. Also found some people suggested to use Ogg Theora, but I will need to port it to iPhone if I use it. (Which I am not sure how to do it now).
Is there any workaround for this? Any ideas? Thanks.
I think you are in a GPL-bind there and have two suggestions:
Just go ahead and GPL your project. There is no reason you cannot sell open source software, and the app store's delay/penalty period will give you a nice lead time over any potential completing project with the GPL'd code. Your place on iTunes store, your motivation and any branding is probably more valuable than the source code. Plus, you can get other people to fix bugs for you. Update: As of January 2011, GPL and App Store do not mix.
Have the iPhone app upload the raw images to a server and do the processing there. That way you are not releasing and distributing the FFmpeg and x264 code, and are hence not required to distribute it.
Good luck and let us know here if you get it published!
Appears ffmpeg now has support for cisco's "openh264" (BSD FWIW) encoding codec:
https://www.ffmpeg.org/ffmpeg-codecs.html#libopenh264
FWIW here is what I get from my LGPL build:
ffmpeg.exe -codecs | grep h264
...
ffmpeg version n3.1.2 Copyright (c) 2000-2016 the FFmpeg developers
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_qsv ) (encoders: libopenh264 h264_nvenc h264_qsv nvenc nvenc_h264 )
which mentions a few other encoders FWIW, and FFmpeg might support even others.
I believe you'll only be able to find commercial versions of x264 implementations if you don't intend to use ffmpeg (there might exist a few other opensource versions but with very low quality). Also, you need to bear in mind that if you make use of those codecs and you decide not to use the platform/iPhone ones you will have to pay royalties because of the patents (I think it's roughly 1 dollar per download).
If this is still affordable to you, then I believe you might be able to find an older version of ffmpeg that was LGPL'ed. You can use this in your code without having to open source the whole project. You only need to opensource changes that you might make to ffmpeg.
Hope this helps!
Related
I'm writing an Chrome Packaged App that needs to be able to play a lot of local video files. I can use the tag to play files encoded in h.264 and mp3, but not much else. I'll require playback of at least DivX videos and AC3 audio. Is there any way to do this using the HTML5 platform or otherwise using some kind of plugin?
There are alternatives, but in my opinion the final solution is not going to be very good.
1 - You can try to use a plug-in, for example:
VLC Plug-in - sorry, I have not enough reputation to post more than 2 links :(
Divx Web Player - sorry, I have not enough reputation to post more than 2 links :(
But then you need to rely on the user installing the plug-in. For VLC, the plug-in is not compatible with the latest versions of Mac OS X.
2 - Encode to H.264 or VP8 from a server with an ffmpeg or using a cloud video provider.
3 - Encode from the client side using JavaScript! There is a port of the ffmpeg on javascript (http://bgrins.github.io/videoconverter.js/). I didn't try this method with large files.
4 - Encode from the client side using a Native Client component (https://developers.google.com/native-client/dev/). But seems a daunting task to me.
If you are going to go with the first option, assure that your audience is going to install/configure your player and that their OS are supported.
VLC ported to NaCL would be a great first step.
According to a poster on https://forum.videolan.org/viewtopic.php?f=5&t=107178, libVLC has been ported to NaCL, but I am not familiar with VLC internals so I could not say how far this gets you in terms of being able to decode different streams.
I receive raw H.264 NALUs from an IP camera (via Live555) and I want to decode them using hardware because FFmpeg is great but it's too slow (the camera sensor is large).
The only solution I see is to write the NALUs to some movie container file such as MPEG-4, and then read and decode that file using an AVAssetReader.
Am I off in the weeds? Is anyone having success decoding H.264 NALUs from a stream? Does anyone have any tips for writing NALUs to an MPEG-4 file? Other ideas?
Like Matt mentioned, there is no direct access to Apple's H264 decoder.
However, I have had success with ffmpeg and h264 decoding. Like you mentioned, I have built ffmpeg with LGPL I was able to decode H264 streams all the way to real-time HD stream with no latency on both ipad and iphone. Nothing fancy is required from ffmpeg, you can find bunch of standard decoding c++ code that will work just fine on iOS. Also, in my case H264 NALUs were delivered via RTP/RTSP in real-time.
Also, if I was you I would run your app through xcode instruments to truly see where you bottleneck is, but I would be highly surprised it is in ffmpeg decoding step.. Hopefully this info helps.
Unfortunately, you cannot do this at present. Feel free to file a radar with Apple about wanting this sort of access to the hardware decoder. It'll certainly be resolved as a duplicate :-). I assume it is for licensing reasons why they can't give this sort of access to the hardware codec.
So, you're going to have to use a software decoder. Please be aware that if you're going to ship to the App Store then you need something with a non-GPL license (unless you want to open source your app as well).
I've been searching a lot for ffmpeg on iphone, and how to use it to steam audio(wma ect.)
but cant figure out how this is done.
can someone please try help me on, how to/what to, download and how i get the ffmpeg lib. into my xcode project, so i can use it to steam some links i have ?
another thing is, i read something about the lisence somewhere. is it really true, that if i use the ffmpeg lib, i need to make my project/code, open source?
There is this existing question on SO, but…
You might want to read the Media Player Framework Docs as the functionality you mention already exists in the iOS SDK for many non WMA files. It is probably going to be less of a headache to convert them to mp3 or another format on your server and go from there using the built-in tech that Apple provides.
I know this isn't quite a programming question but it's very closely related to iPhone/iPad development.
What's a good software (preferably with a GUI) for converting videos to iPhone/iPad compatible mp4s? My videos are mostly mpg, avi, mov.
Handbrake will do a great job, its free, its open source, and it is on Windows, Linux, and Macintosh.
I know it takes file inputs from any source on Windows (I'm not sure on Mac, but I'm pretty sure its the same on Mac).
Handbrake is my favorite tool for this job. Free and Multiplatform.
Integrates with all of the appropriate preset for iPhone / iPod / iPhone 4
Just for note: I use ffmpeg library to convert all my media. Yes, it doesn't have UI but it supports probably almost all the video/audio formats you need + it's very easy to use it with scripts when you want to convert a big amount of media.
My app takes time-lapse photos, and also records audio to go with it. The problem is, I have absolutely no idea how to go about turning it into a .mov/.mpeg file (I am new to this type of iPhone development). I have heard some things about FFMPEG, but apparently the license doesn't cover the public distribution of iPhone apps. Anyone have any suggestions?
you can use Theora aka VP3. it is free to use in any application and has a pretty decent quality/bitrate ratio
I do not know whether the necessary parts of FFmpeg to do this is GPL or not, but there are parts of FFmpeg that are LGPL-licensed.
They have a legal page that covers this in detail, so FFmpeg might be worth a closer look.
FFmpeg itself can be used in iphone apps distributed on the appstore. See wunderradio as an example: http://www.wunderradio.com/code.html
BUT... I am experimenting with it right now and I am kinda disappointed with the quality of the result. (not to mention that encoding is sloooow on the iphone) It seems to me that without the x264 library it is impossible to create mpeg-4 videos with decent quality. And x264 is GPL licensed, so if you use it, you must disclose the full source of your project. (Or did anyone figure out how to select some usable codec from the LGPL-d FFmpeg?)
What I don't understand is that the appstore has now a lot of video editing apps. How do they work? I made a pretty thorough search, and couldn't find any mpeg-4 codec with a permissive enough license. Do they violate GPL? Do they use private API? I really don't believe that they built a homebrew mpeg4 encoder.