Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to upload media file?

New Here ,
Jul 07, 2017 Jul 07, 2017

Hello,

I would like to upload media file in s3 using Premiere Pro. extension.

For that, I have created one  Premiere Pro. extension.

I have used below code to upload media.

uploadOnS3 = function (data) {

    console.log('uploadOnS3 called');

    var AWS = require('aws-sdk');

    AWS.config.update({

          accessKeyId: "XXX",

          secretAccessKey: "XXX"

    });

    var s3 = new AWS.S3();

    var bucketName = 'flex-qa3';

    var keyName = 'AA.mp4';

    var params = {Bucket: bucketName, Key: keyName, Body: data};

    var options = {partSize: 10 * 1024 * 1024, queueSize: 1};

    s3.upload(params, options, function(err, data) {

      console.log(err, data);

    });

}

uploadFile = function () {

    console.log('uploadFile called');

    var fsModule = 'fs';

    var fs = require(fsModule);

    // First I want to read the file

    fs.readFile("D:/Projects/AA.mp4", function read(err, data) {

          uploadOnS3(data);

     });

}

uploadFile();

I have added node js support in manifest.xml file in extension and I am using 'aws-sdk' for s3 upload.

<CEFCommandLine>

   <Parameter>--enable-nodejs</Parameter>

   <Parameter>--mixed-context</Parameter>

</CEFCommandLine>

                       

         

I can upload this file successfully on s3 but when I download this file and open with media player.

It couldn't play and it is corrupted.

Same code when I run with directly by node application without Premiere Pro. then it works and media file doesn't corrupt.

Same way when I download the file using 'FS' module in premiere pro then file corrupted and couldn't open in media player.

The Same code works outside the Premiere Pro. well.

Could you provide the proper way to upload and download media file?

Do I need to use any encoding type?

Are there any specific changes in Premiere Pro related to Buffer API and read/write related API?

Premier Pro. Version: 11.0

TOPICS
SDK
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Aug 30, 2017 Aug 30, 2017

Thanks @Nirav, that explains your problem. There could be few improvements to your code, one of them would be having error check during readFile. Please refer to javascript - Get data from fs.readFile - Stack Overflow

Translate
Community Expert ,
Jul 07, 2017 Jul 07, 2017

Moved to Premiere Pro SDK forum.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 07, 2017 Jul 07, 2017

Hi,

this is looking similar to this thread, only the other way round: https://forums.adobe.com/thread/2340929 .

Do you happen to know if the uploaded file is already corrupt, or only the (re-)downloaded one?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2017 Jul 07, 2017

No, its play in media player very well before upload but when I download uploaded file, that was corrupted

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 07, 2017 Jul 07, 2017

My question was if you can verify the uploaded file on AWS is intact. So on the AWS, after uploading, before downloading.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 09, 2017 Jul 09, 2017

That file corrupted cause the actual size of a file is 3.59MB but when I saw on s3 it was 4.86MB. So the problem is in uploading the file from the Premiere Pro. as I had already told that same code works well from outside the panel using directly node js.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 11, 2017 Jul 11, 2017

Can anyone please help for this issue?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 12, 2017 Jul 12, 2017

You're asking for help with Node.js upload questions, in a forum about Premiere Pro's APIs.

A place to start = does your uploading function behave differently, or give different results, when running within a panel, instead of a web browser?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 29, 2017 Aug 29, 2017

Hey Bruce. Nirav did indeed run the code outside the PrPro panel and it worked fine, which is what caused him to raise the question here...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 29, 2017 Aug 29, 2017

I've asked the CEP team to respond.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 29, 2017 Aug 29, 2017

@Nirav, Can you please record md5 values before uploading the file? and after downloading the file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 30, 2017 Aug 30, 2017

The file size is different so both md5 should be different.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 30, 2017 Aug 30, 2017

Thanks @Nirav, that explains your problem. There could be few improvements to your code, one of them would be having error check during readFile. Please refer to javascript - Get data from fs.readFile - Stack Overflow

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 03, 2017 Sep 03, 2017
LATEST

I haven't got any error while readFile.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines