How do you upload a video to youtube using json-c format? - objective-c

I'm able to upload videos to youtube using their xml input/output format but their documentation on how to implement uploading with json-c is frustratingly sparse. For instance, what is the 'key' for the json data I'm sticking in the body? Or put a different way, how is the json string added to the body of the request?

Here are instructions for uploading a video using JSON-C:
https://developers.google.com/youtube/2.0/developers_guide_jsonc#Add_Video
The upload is done in two parts: 1) First you upload the metadata in JSON format. The response of this will contain an upload url. 2) Upload the actual video to the upload url.
However #Alexander is right, the Objective-C client may be a better route, since it handles all the upload details for you:
http://code.google.com/p/gdata-objectivec-client/

Related

Vimeo Upload API

I'm trying to upload videos to my Vimeo account via their API using the TUS approach.
I've managed to get the first step working fine, using POST https://api.vimeo.com/me/videos to create the video placeholder in Vimeo, and getting a response which includes the video upload.upload_link
The second step requires the binary data of the video to be patched to the upload link returned in step one using PATCH{upload.upload_link} along with some specific headers, which is fine, but what I'm struggling to work out is where and how exactly to include the binary data, as it doesn't really say in the Vimeo API documentation.
Do I just put the binary data in the Body, on it's own? Or do I need to insert it between some code in the body? Or do I set a parameter and add it as a key value, and if so what is the key?
Also, I'm assuming it should be a binary string and not base64, is that correct?
Any help or guidance on this would be much appreciated.
You put the binary data directly in the request body. Vimeo API uploading uses the tus upload protocol. There is more information about the PATCH request at https://tus.io/protocols/resumable-upload.html#patch

How to stream an HTTP POST request's body in the browser

The big picture is that I want to live upload recorded audio from the browser directly to google drive.
This is a pet project so I am happy to play with experimental web technologies.
I currently have the browser fetching a feed from the microphone using MediaDevices.getUserMedia() and encoding it to mp3 in a WebWorker. The encoder returns an rxjs.Observable<Int16Array> that will produce chunks of the encoded file on subscribe.
I would like to use a resumable upload to upload the file, preferably in the "single request" style. The challenge is in uploading the file as it is produced by the encoder.
I appreciate that I could probably achieve a similar result by using their "multiple chunks" style and collecting the results of the encoder into Blobs and sending them on an interval. My problem with this is that the more "live" the upload is (smaller chunks) the more POST requests I will be making.
XMLHttpRequest.send() does specify that I can provide a ReadableStream as the body. BUT it appears that this experimental tech does not yet support byte streams

Telegram API, uploading images to get a FileID in VB.NET

I recently started building a little bot in VB.NET and got pretty far with it. Though, there are quite some things I'm simply not getting far with.
One of these things is uploading an image.
I use the Telegram API as a DLL which is pretty nice so far.
Though, I struggle with uploading pictures.
The code itself is Telegram.bot.SendPhoto.sendFromFile_id(chat_id, <fileID goes here>).
it is pretty much self explanatory, though I have no idea how I can obtain a fileID. The API itself does not explain how to do it, and I'm not that good in reading other codes from other languages and translate them over into the language I'm using at this moment.
Is there any kind of solution for this I could try to use?
Telegram API Document description about FileID ( Source:Telegram Bot API ) :
There are three ways to send files (photos, stickers, audio, media, etc.):
If the file is already stored somewhere on the Telegram servers, you don't need to reupload it: each file object has a file_id field, simply pass this file_id as a parameter instead of uploading. There are no limits for files sent this way.
Provide Telegram with an HTTP URL for the file to be sent. Telegram will download and send the file. 5 MB max size for photos and 20 MB max for other types of content.
Post the file using multipart/form-data in the usual way that files are uploaded via the browser. 10 MB max size for photos, 50 MB for other files.
I have same problem and solve this way :
1.first upload image to cloud and get image url
2.set URL file_ID
C# Code example :
String ID = bot.chat_id;
bot.SendPhoto.sendFromFile_id(ID, "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png");

Download chunks of MP4 file from iOS

I am developing an iOS app that synchronises with GoPro cameras.
One of the feature requires downloading MP4 from the GoPro (potentially huge).
I basically have a url like: http://10.9.9.5/whatever/video.mp4.
However, I only need parts of the video, let's say between 1:00 and 1:05.
I am thinking on downloading just parts of the MP4, using HTTP "Range" header. I believe that it's possible and I will get a bunch of bytes.
However, is it a valid file? Will I be able to create a MP4 ? Do I need the MP4 header with meta information? Do any of you faced this kind of challenge?
I am using Objective C but I believe that this is a general question.
The MP4 file is a container for video that is structured around something called boxes. Probably you'll have h.264 video in that MP4 file, knowing that, you'll need to know the structure of the file you are trying to chunk.
Depending on the way it is encoded you'll have to look for a box with metadata that'll allow you to search for the correct part of the file either at the beginning or at the end, but you'll have to reconstruct a valid MP4 with the data you get from the original file.
You can see a reference of the file format here http://xhelmboyx.tripod.com/formats/mp4-layout.txt.

Using HTTP From FMS Server 4 to Upload Video

We have an application where a user records video which is encoded by Adobe Flash Media Server 4. We now need to put that file on an S3 bucket to get it into our CDN. Ideally we would simply like to PUT the file to the bucket using the RESTful interface once the encoding is complete but it looks like LoadVars does not support PUT. So now our two options are:
Use multipart/form-data in the RESTful interface, but doing all that boundary stuff looks complicated.
Use PutObjectInline in the SOAP interface, but now I have to base64 encode the file, and I don't see how to do that.
You would think that 'encode video, put on world wide web' is a common enough problem but apparently not.
Any suggestions would be appreciated!