iPhone encrypt and decrypt mp4 files - iphone

Can anyone suggest or provide a reference link of how to do the mp4 files encryption and decryption in iPhone/iPad ? I have tried google it but I couldn't fine any answers from it.
All I want is to encrypt the mp4 files and store into the apps bundle. And decrypt it before start playing the mp4 file. Since I don't want people to use some third party tools to steal the mp4 files.
Thanks so much.

It won't help prevent your mp4 from getting stolen.Since you have to play it ,then it's there in the temp dictionary.
Anyway if you still wish to do this, simply convert it into a NSData and save it anywhere you want.

As long as you can decode them, you can encode them just in any ways...
Something as simple as the Caesar cipher will work... Or you can do more complicated stuff...
An MP4 file is just bits... So you can crypt/decrypt them as you want...

Related

iOS: Record audio in other format than caf

I am working on audio recording. I am able to record my audio in caf (Core audio format). Now I want to record sound in .mp3 or .amr.
I tried a lot of google but didn't found anything. I am not sure if my steps following work:
Write that Audio with .caf extention to document dir
Read data from that file
write the file again with .mp3 or .amr extention
I have 100% doubt that this will not going to work as this will just re save file with some other extension. This won't change audio codec.
I thought that for converting any format whether it is audio or video we need to change its codecs and data sequence.
Please also suggest me any player which don't play .caf files not anything else. So I can make sure that my files are converted successfully.
UPDATE Please also let me know that the way I am re-writing data with different extension is correct in the way I am needed?
You might be interested in the iPhoneExtAudioFileConvertTest example.
The MP3 format is however not available due to patents, maybe you can use LAME.
From the Document The Basics: Audio Codecs, Supported Audio Formats, and Audio Sessions

How to convert audio binary on server from iPhone POST request?

I have a working POST request that will send a CAF audio file (recorded on the iPhone with AVAudioRecorder) to a web server -- the request itself is structured similarly to Send an audio FILE and JSON string in iOS.
The server correctly receives the file, but I'm having trouble converting it into a format that will play directly in a browser. In addition to every audio/iPhone/server post I could find on stack overflow, I've looked into ffmpeg and HTML5 audio as well, but couldn't find clear instructions on how to convert the received audio binary to a browser-playable format. Essentially, I need to understand how to accomplish Arun's server-side suggestion here.
I know that Audacity, Soundbooth, etc. will allow you to use the raw data and save it as another format, but I need this to be done programmatically on the server. If there are any suggestions they would be very much appreciated! Thank you.

Playing .flv files on iphone

I have a webservice returning .flv file, it has to be played in iphone application, how do i play a .flv (flash file) in iphone?
Does anyone has faced this scenario? Programmatically is it possible to convert to some format and play in iphone?
Thanks.
IPhone doesn't and judging by the Apple official statements won't ever (or at least in the forseeable future) support flash content.
Converting the content to another format on the server side should be easy to do and would allow content playback on an iDevice.
SInce the video is probably already h.264 encoded inside the FLV container, you may want to try FLV Extract on the server to avoid recompression:
http://www.videohelp.com/tools/FLV_Extract
Basically you just need to run it once for each of the videos on the server and keep the results around.
I would recommend setting up your webservice to use something like ffmpeg ( http://www.ffmpeg.org/ ) to convert the .flv file to an mp4 file which can be played directly from the iPhone's web browser.
Pioto and Josaih are on the right track in suggesting that you should convert the video server-side using a tool like FFMpeg. As far as I know there is zero support for flv in any part of iOS, so you'd be unable to transcode it locally. Even if you could, it would make your users angry, since transcoding is a resource-intensive process that would kill their battery life and take a significant amount of time.
So, your solution is to transcode your videos to h.264 server-side. However, I'd caution against transcoding from flv->h.264 if there are any other options available. If you have the original, uncompressed (or at least less-compressed) source video available, you'll get higher-quality video by transcoding that to h.264. Each time lossy compression (eg, squeeze or h.264) is used on a file, you lose some information and quality. If you've ever seen a 3rd or 4th generation copy of a VHS tape, you can understand what I'm getting at.
Once you have a h.264 formatted video, you can play it on iOS. Not sure about the exact details of this.
You may be able to use ffmpeg or something on your server to transcode it to H.264. I'm not so sure you would really want to do that transcoding on the phone. Given Apple's current stance on Flash, this is probably your best option.
For FLV files, what I do is I upload them on Google Drive and watch them from Google Drive app.

Create video in iPhone

I need to convert image sequences(ie,png) to video file in iPhone. How i can convert the images to video.
Regards,
Just ignore bad advice like "use ffmpeg". That would work on the desktop, but the license issue makes including ffmpeg source code in your iPhone app legally questionable. Apple provides a class named AVAssetWriter that you would use in your app to encode a series of images as h.264 stored in a .m4v quicktime container file. While the apple provided logic does work, it is not so easy to actually use and you will need to read quite a lot of documentation to get the code working. If you want to skip implementing it yourself (and likely save yourself 3 or 4 days of work), please consider using my AVAnimator library for iOS as the h.264 encoding logic is already implemented in the class AVAssetWriterConvertFromMaxvid. Once encoded as h.264, the video can be played with the standard player and it is small enough to upload to a remote server.
You are likely going to need something like FFMPEG

convert caf on iphone or on server for sharing

I have an app that records short sounds (as caf files) and uploads them to a server. I want to be able to share these sounds so they need to be in a more ubiquitous format like mp3. I've got a linux server. Is there anything I can use either on the iphone or the server to perform the conversion?
thanks,
Howie
Looks like I solved my own problem, but I'm open to any other solutions.
I've installed Sox and libsnd on my server. If I upload a caf file I can use SoX to convert from caf to mp3.