Can I upload already-encoded content to azure media services, instead of uploading a video and then encoding it? How? - encoding

I want to encode locally and upload to avoid spending money in encoding.
Is this allowed? I did not find any documentation on it.
When I simply uploaded a file to the storage, the media services account said it could not play it without the ISM file. I had to encode (was it re-encode? it was an mp4) the file I had uploaded - I want to avoid that.

Yes, absolutely allowed and encouraged for customers. Especially ones that have custom encoding requirements that we may not support.
You can upload an .ism file that you create along with your encoded files. It's a simple SMIL 2.0 format XML file that points to the source files used.
It's a bit hard to find searching the docs, but there is a section outlining the workflow here - https://learn.microsoft.com/en-us/azure/media-services/latest/encode-dynamic-packaging-concept#on-demand-streaming-workflow
There is also a .NET Sample showing how to do it here:
https://github.com/Azure-Samples/media-services-v3-dotnet/tree/main/Streaming/StreamExistingMp4
You can see the code line at 111 that shows how to generate the .ism file -
// Generate the Server manifest for streaming .ism file.
// This file is a simple SMIL 2.0 file format schema that includes references to the uploaded MP4 files in the XML.
var manifestsList = await AssetUtils.CreateServerManifestsAsync(client, config.ResourceGroup, config.AccountName, inputAsset, locator);

Related

APIs/Services to Generate Thumbnails of Document

We have a website, which allows users to upload documents (word, pdf, PPT, etc.).
We are uploading files to Amazon S3. So, all files will have it's own web URL.
For these uploaded documents, we would like to generate thumbnails. This thumbnail needs to be generated based on it's content (like Google document viewer).
Is there any Service/API, which generates thumbnails of documents by it's URL?
Thanks and Regards,
Ashish Shukla
You could roll your own solution. I'm evaluating 2JPEG and it appears to support 275 formats including Word, Excel, Publisher & Powerpoint files. fCoder recommends running 2JPEG as a scheduled background task. The command line syntax is pretty comprehensive. I don't think it has the ability to process remote AWS files, but you could retain it locally temporarily, generate the thumbnail and then delete the local source file.
Here's a sample snippet to generate a thumbnail for a specific file:
2jpeg.exe -src "c:\files\myfile.docx" -dst "c:\files" -oper Resize size:"100 200" fmode:fit_width -options pages:"1" scansf:no overwrite:yes template:"{Title}_thumb.jpg" silent:yes
You should also take a look at AWS Lambda. In fact, this presentation from the AWS re:Invent 2014 conference shows a live example of using Lambda to generate thumbnail images. This solution will be very reliable, and very cost-effective, but has the downside that you'll be responsible for maintaining the code, or debugging issues.

Google Drive: Automatically convert files on upload?

Is it possible to get Google Drive to automatically convert uploaded documents to the native format?
I know it works with manual upload (i.e. Google Drive can auto-convert files you upload via the website), but I want to avoid having to upload every file by hand.
I'd prefer to use the API, or better yet, dump the files in my ~/Google Drive folder.
Using the API, you can pass the convert=true parameter to files.insert. The uploaded file will attempt to be converted to a native Google Docs format.
Sure, see this answer. Note you can upload a text file or a csv file and set its content type to google doc or google sheets respectively, and google will attempt to convert it. I have tested this for text -> doc and it works. You will need to set the const contentType at the start of the code to one of the supported google mimetypes.

Appending data to a file on a FTP server in iOS

After learning the basics from Apple's SimpleFTPSample project, I'm trying to append a string to the end of a .txt file on my FTP server. I successfully managed to overwrite an existing file with a custom string, but I suspect that the kCFStreamPropertyAppendToFile property that defines whether the file will be overwritten or appended is not available in iOS.
What is the recommended way to do so in iOS?
Eventually I ended up downloading the file's content using HTTP (it's much faster than FTP). Next, appending the string to the file's content and then uploading the file to the server using FTP.
This might not be the best solution, but it does solve the problem.

How can I download a .webarchive with ASIHTTPRequest?

I was just wondering how I can download a .webarchive from my UIWebView using ASIHTTPRequest. I've looked at their documentation but unfortunately, it doesn't mention anything about saving web archives.
I noticed that this app saves .webarchives to the iOS device and loads them.
To quote http://en.wikipedia.org/wiki/Webarchive :
"The webarchive format is a concatenation of source files with
filenames saved in the binary plist format using NSKeyedEncoder"
As jbat100 mentions, the ASIWebPageRequest code is likely to be a useful starting point - you'll need to write code to do the saving of the files into the binary plist format yourself.

Upload text file on FTP server using iPhone

I have implemented code for uploading images and directory to FTP using iPhone.
But I need to upload text file on FTP using iPhone. Can you please send me code for that.
Here's an example:
http://modmyi.com/forums/iphone-ipod-touch-sdk-development-discussion/328541-ftp-usage-iphone-applications.html
It uploads one byte at a time, so be sure your strings are ASCII encoded if you are expecting ASCII.
Here is a script to upload entire directory including text, binary etc. files. It creates subdirectories as needed.
http://www.biterscripting.com/SS_FTPUpload.html
Start with that script and change it to suit your particular situation.