Options

API v2.0 No method to download original images/videos

pominnzpominnz Registered Users Posts: 4 Beginner grinner
Hi,

I've started using the v2.0 API, but I keep hitting problems.

Initially I was using Response.AlbumImage.ArchivedUri from endpoint AlbumImages to download the images and videos. This works okay for images, but not for videos. All of the videos were the correct duration, but only display the very first frame for the entire duration.

I then discovered Response.AlbumImage.Uris.LargestImage which works okay for images. Response.AlbumImage.Uris.LargestVideo works okay for mp4 videos, but doesn't exist for mpeg videos.

I'm not sure of the correct method for downloading the original images and videos using API v2.0, so help would be much appreciated.

Cheers
Paul

Comments

  • Options
    gabbiegabbie Registered Users Posts: 66 Many Grins

    Hi Paul,

    Could you send us a link to one of the albums that you have videos in? The behavior you're describing doesn't line up with what we would expect either, so we're going to look into things from our end. Most of our API team is out of the office right now, so it might take a couple of days, but I'll make sure to keep you in the loop.

    gabbie
    SmugMug Product Manager
  • Options
    pominnzpominnz Registered Users Posts: 4 Beginner grinner
    edited April 6, 2017
    This is the link for the album.
    https://www.smugmug.com/api/v2/album/Dcdn9C

    This is the link for a video.
    https://www.smugmug.com/api/v2/album/Dcdn9C/image/b7STtxG-0

    The Filename correctly indicates a video, and isVideo is set to true.

    The ArchivedUri has a link for a jpg image, but when I click on it, it downloads a video file.

    When I attempt to view the video file, it is the correct duration, but only displays the first frame all of the way through.

    I have also attempted to download the video from the ImageDownload object.
    https://api.smugmug.com/api/v2/image/b7STtxG!download
    But it results in the same issue described above.

    The object LargestVideo has a correct link and the original video is downloadable as long as it is an MP4.
    https://api.smugmug.com/api/v2/image/b7STtxG-0!largestvideo

    If the video is an MPeg, then the object does not exist.

    Is ArchivedUri the correct object to download the original images and videos?
  • Options
    gabbiegabbie Registered Users Posts: 66 Many Grins

    Thanks for the additional detail Paul! I'll get back to you first thing next week with more information.

    gabbie
    SmugMug Product Manager
  • Options
    pominnzpominnz Registered Users Posts: 4 Beginner grinner
    Thanks gabbie

    The first time I noticed the video downloading issue was actually with PicBackMan. I'm not sure which API version they are using. It was because of this issue, I attempted to write my own application, but then hit the same problem.
  • Options
    pominnzpominnz Registered Users Posts: 4 Beginner grinner
    edited April 12, 2017
    Some more information related to this issue.

    I've noticed that the IsArchive flag can show false even when there is an archive video.

    If I try with an MPG format
    https://api.smugmug.com/api/v2/image/Ch7MBvB-0
    ArchivedUri: https://photos.smugmug.com/Videos/Cuba-Street-Carnival-2007/i-Ch7MBvB/0/D/video0910_512-D.jpg
    When the archive is downloaded using the URL, it is actually a video file, not a jpg. The URL is misleading, because this is a video file.

    If I try and do the same for an MP4 format
    https://api.smugmug.com/api/v2/image/b7STtxG-0
    ArchivedUri: https://photos.smugmug.com/photos/i-b7STtxG/0/D/i-b7STtxG-D.jpg
    I get a video file with a single frame for the duration (as per the description in a post above)

    I have also tried using the following URLs to download the videos, but these end up with inconsistent results too.

    If I try with an MPG format
    https://pominnz.smugmug.com/Videos/Cuba-Street-Carnival-2007/i-Ch7MBvB/0/D/video0910_512.mpg
    Correctly gives me a working video file

    for MP4 format
    https://pominnz.smugmug.com/Sort/2016/Master/i-b7STtxG/0/D/VID_20160123_143041710.mp4
    I get the video file with a single frame for the duration.

    I've also noticed that the OriginalSize field for the MP4 format is wrong. It states 883,442, but the actual size of the file is 9,362,113

    Thanks
  • Options
    bwgbwg Registered Users, Retired Mod Posts: 2,119 SmugMug Employee

    Hi Paul,

    I'm trying to unwind the video issues, but quickly; the IsArchive flag on the Image indicates whether this is a SmugVault (our raw storage product) Image and has nothing to do with the Archived original. Horribly named on our part.

    I'll let you know what I uncover about the video downloads. Thanks for your patience.

    Cheers,
    Lee

    SmugMug API Sorcerer

    Pedal faster
  • Options
    bwgbwg Registered Users, Retired Mod Posts: 2,119 SmugMug Employee

    Hi Paul,

    tl;dr; To download a MP4 video you'll want to use the LargestVideo endpoint. To download a MPG video, you'll need to use the Original or Download endpoints. Just as you've discovered.

    Here's the story.

    1. We don't currently keep an "archive" copy of videos (an archived copy being the original uploaded bytes) like we do with photos. We transcode the video into MP4 sizes and discard the original uploaded bytes.
    2. "Original" in our size listing always equates to a photo size, and "Download" eventually gets mapped to an "Original" size. Thats why you see ".jpg" extensions on the download url and get a jpg poster frame when you hit either the "Download" or "Original" endpoints.. Except for MPG videos.
    3. We haven't transcoded into MPG for many many years and the code supporting them has been untouched for as long. MPG videos actually only support the "original" size for returning a video file. Any other size will either give you a jpg or 404 depending on the code path.

    I realize none of this is particularly helpful or obvious. Its pretty clear that the expectation of the Download uri for a video is not to receive a JPG and I consider that a bug. We're currently auditing all the endpoints and i've made a note to get this fixed up.

    Thanks for your patience and bringing this to our attention.

    Cheers,
    Lee

    SmugMug API Sorcerer

    Pedal faster
Sign In or Register to comment.