How to create thumbnail from an uploaded video on dmcloud.net - file-upload

I am using the Python SDK to upload videos on dmcloud.net.
Now I want to give the user of my application the possibility to choose a thumbnail to the video he uploaded. How can I generate different thumbnails from an uploaded video on dmcloud.net.
Thanks.

Through the SDK, you can update the video thumbnail using the set_thumbnail method of the Media API. You have two options:
Specify a URL to a new thumbnail
Specify a timecode, which is a time offset within the video
For your end-users, provide a way to let them specify a URL or an offset (verify it's an offset that's appropriate for the video's duration). If you're using a custom player, you can probably let them choose an offset visually by pausing the player on their frame of choice and then extracting a time offset from your player for the dmcloud API call.
If you choose to set a thumbnail by timecode (offset), the SDK call would look like this:
cloudkey.media.set_thumbnail(id, timecode)
SDK Link: http://www.dmcloud.net/doc/api/python-sdk.html#media-object

Related

React Native: Get Duration of local video

I am currently using react-native-image-picker to allow a user to select a video from their gallery. I am trying to disallow them from uploading a video that is greater than 'X' number of seconds. Is there anyway to programmatically retrieve the duration of the video, or is there another library that can be used to select videos from the camera roll that will provide all the information for the media object as well?

OpenTok TokBox: Video in vertical presentation looks like in horizontal presentation after archiving

Our aim is to show portait video (vertical orientation in terms of TokBox) without black areas right and leftside after archiving. Now it looks like landscape with black areas on right and left side.
We are using php server and android client for streaming.
Our steps to convert live stream in video on demand through archieving are:
start session
update stream with the parameter layoutClassList = verticalPresentation (php library)
start archieving
live stream is on -> create subsriber and watch the stream. IMPORTANT! The stream has no black areas and has CORRECT presentation on subsriber side!
stop archieving
waiting TokBox upload archieving file to Amazon s3 bucket -> the file ALREADY contains black areas right-leftside. WRONG! (please watch the video on link for better understanding https://s3-us-west-1.amazonaws.com/edtv-dev1-input/46176492/9f26ef23-aee6-42f2-8c51-d8e2685abcc9/archive.mp4 )
processing the file
Are thereabove the correct steps to achieve the goal - get video file without black areas (in portrait orientation)? Are we missing anything?
Is archieving process on TokBox sensitive to horizontal/vertical presentation? is it possible to archive the video in vertical orientation?
UPDATE: What we wanted was not composed, but INDIVIDUAL stream! TokBox creates zip file, but Amazon AWS was able to transcode it and get the correct result both in portrait and landscape orientations.
NOTE: As a default result file on Amazon AWS after Individual stream archiving is *.zip (json + video file in it). The trascoder we used gave us video without sound. So we added lambda that unzipped the file. Now everything is ok, but took a lot of time and headache.
Tokbox developer here
For composed archiving, the only two options currently available for output resolution are 640x480 and 1280x720. Trying to fit a portrait video into a canvas of the available resolutions will result in the video you are seeing.
Possible solutions:
Use the custom layout control [1]: you can override the "object-fit" property to "cover". This may not result in exactly what you want, since the output resolution will still be 640x480 or 1280x720, but the video will occupy the whole canvas, at the expense of cropping the top and bottom part. See [2]
The best solution in my opinion is to use "individual stream archiving", where the resolution will be kept as the original, and you get a file per stream. Please check [3]
https://tokbox.com/developer/guides/archiving/layout-control.html
https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
https://tokbox.com/developer/rest/#start_archive
How can we get URL within the zip created by opentok which was uploaded in s3

Projekktor: supporting multiple video sizes

I am using Projekktor to display video, but if someone is using, say, an iPhone I want to send out a smaller video than the full 1080p that might be sent to a browser.
Is there a built-in way to do this, or do I need to do a user-agent check and create a playlist based on the device manually?
You can configure Projekktor to fetch a specific video file depending on the dimensions of the video display.
To do so you need to provide multiple video video files with different resolutions for each format you want to deliver and set a "quality" property for each of them.
To alter the dimensions/quality mapping you have to set the "playbackQualities" config option
The whole logic is described in detail over here.

Generating a random preview image on a HTML5 video tag

Is it possible to capture a snapshot of a video that's loaded using the HTML5 video element and use that as a preview image until the video loads or the play event is triggered? I know about the poster attribute but I want the thumbnail to be self generated, like a random frame from the video. Sort of what YouTube/Vimeo does.
Thanks,
I don't think that this is possible in pure HTML5. Principally because the stream is not loaded when you see the 'object' in the webpage so the client can't get the desired frame.
However, the best option for you is to save / cache the 'random frame' before loading the page and then use it as the poster of the video. This will allow you to reduce the client work and save the bandwith.
check THIS, which is the first thing that I've found (if you're using PHP and you want a 'quick and dirty' way to get the frame)
Update
Apparently HERE there is a solution with popcorn.js BUT it seems that you can't do it in the way that (I suppose) you need.
This because it would be possible to do this only inside the same domain due to browser security issues.

Which one is the folder containing iPhone/iPad images

I'm developing an application and I'd like to list the images present in the "Documents" directory of my application (to load images using iTunes) and I'd like to list the images and photos taken by the Camera as well.
And I do know about UIImagePickerController, but I don't need that. I want to integrate the photos and the loaded application images in the same place. But I can't find any information about where can I find all the device camera photos.
Thanks in advance
You can access all the photos stored in the photo library using the Assets Library Framework. Check out the documentation here:
https://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/AssetsLibraryFramework/_index.html
Specifically, you want to use ALAssetsLibrary's enumerateGroupsWithTypes:usingBlock:failureBlock: to enumerate the ALAssetsGroupSavedPhotos type, and enumerate the photos in that group with ALAssetGroup's enumerateAssetsUsingBlock:.
Some links with sample code:
http://www.icodeblog.com/2010/07/08/asset-libraries-and-blocks-in-ios-4/
http://www.fiveminutes.eu/accessing-photo-library-using-assets-library-framework-on-iphone/