Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (80)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

Sur d’autres sites (4273)

  • Uploading video to Twitter sometimes doesn't work

    22 juillet 2021, par K-s S-k

    I have a very difficult situation. I've already spent 2 days and couldn't find a solution. Project on Laravel. I want to upload videos to Twitter using the Twitter API endpoints. But sometimes I am getting this error :

    &#xA;

    &#xA;

    file is currently unsupported

    &#xA;

    &#xA;

    I did everything as recommended in the official documentation Video specifications and recommendations. I get an error when I set an audio codec is aac in my video file, despite the fact that it is recommended in the official documentation, but when I set the audio codec to mp3, the video is uploaded, but the sound quality is very poor, and sometimes there is no sound at all. Please forgive me if this is awkward to read, but I want to provide all of my code. Because I don't know how to solve this anymore and I think it might help.

    &#xA;

    &lt;?php&#xA;&#xA;namespace App\Jobs;&#xA;&#xA;use App\Models\PublishedContent;&#xA;use Atymic\Twitter\Facades\Twitter;&#xA;use GuzzleHttp\Client as GuzzleClient;&#xA;use GuzzleHttp\Exception\GuzzleException;&#xA;use Illuminate\Bus\Queueable;&#xA;use Illuminate\Support\Facades\Log;&#xA;use Illuminate\Support\Facades\File;&#xA;use Illuminate\Queue\SerializesModels;&#xA;use Illuminate\Queue\InteractsWithQueue;&#xA;use Illuminate\Contracts\Queue\ShouldQueue;&#xA;use Illuminate\Foundation\Bus\Dispatchable;&#xA;use Illuminate\Support\Str;&#xA;&#xA;&#xA;class PublishToTwitter implements ShouldQueue&#xA;{&#xA;    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;&#xA;&#xA;    /**&#xA;     * @var&#xA;     */&#xA;    protected $publishingData;&#xA;&#xA;    /**&#xA;     * Create a new job instance.&#xA;     *&#xA;     * @param $publishingData&#xA;     */&#xA;    public function __construct($publishingData)&#xA;    {&#xA;        $this->publishingData = $publishingData;&#xA;    }&#xA;&#xA;    /**&#xA;     * Execute the job.&#xA;     *&#xA;     * @return void&#xA;     */&#xA;    public function handle()&#xA;    {&#xA;        $publishingData = $this->publishingData;&#xA;&#xA;        if (is_array($publishingData)) {&#xA;            $publishingResult = $this->publishing(...array_values($publishingData));&#xA;            sendNotification($publishingResult[&#x27;message&#x27;], $publishingResult[&#x27;status&#x27;], &#x27;Twitter&#x27;, $publishingResult[&#x27;link&#x27;], $publishingData[&#x27;post_name&#x27;], $publishingData[&#x27;user&#x27;]);&#xA;        } else {&#xA;            $scheduledData = processingScheduledPost($publishingData);&#xA;            $postName = $scheduledData[&#x27;scheduleData&#x27;][&#x27;post_name&#x27;];&#xA;            $postContent = $scheduledData[&#x27;scheduleData&#x27;][&#x27;post_content&#x27;];&#xA;            $userToken = json_decode($publishingData->user_token,true);&#xA;            $requestToken = [&#xA;                &#x27;token&#x27;  => $userToken[&#x27;oauth_token&#x27;],&#xA;                &#x27;secret&#x27; => $userToken[&#x27;oauth_token_secret&#x27;],&#xA;            ];&#xA;            $publishingResult = $this->publishing($scheduledData[&#x27;file&#x27;], $postName, $postContent, $requestToken);&#xA;            $publishingResult[&#x27;status&#x27;] &amp;&amp; PublishedContent::add($scheduledData[&#x27;craft&#x27;], $scheduledData[&#x27;file&#x27;], "twitter_share");&#xA;            sendResultToUser($publishingData, $scheduledData[&#x27;user&#x27;], $publishingResult[&#x27;message&#x27;], $postName, $publishingResult[&#x27;link&#x27;], $publishingResult[&#x27;publishing_status&#x27;], $scheduledData[&#x27;social_media&#x27;]);&#xA;            sendNotification($publishingResult[&#x27;message&#x27;], $publishingResult[&#x27;status&#x27;], &#x27;Twitter&#x27;, $publishingResult[&#x27;link&#x27;], $postName, $scheduledData[&#x27;user&#x27;]);&#xA;        }&#xA;    }&#xA;&#xA;    /**&#xA;     * @param $file&#xA;     * @param $postName&#xA;     * @param $postContent&#xA;     * @param $requestToken&#xA;     * @return array&#xA;     */&#xA;    private function publishing($file, $postName, $postContent, $requestToken): array&#xA;    {&#xA;        $result = [&#xA;            &#x27;status&#x27; => false,&#xA;            &#x27;link&#x27; => null,&#xA;            &#x27;message&#x27; => &#x27;Your content can\&#x27;t successfully published on Twitter. This file is not supported for publishing.&#x27;,&#xA;            &#x27;publishing_status&#x27; => &#x27;error&#x27;&#xA;        ];&#xA;&#xA;        if ((($file->refe_type !== &#x27;text&#x27;) || $file->refe_file_path) &amp;&amp; !checkIfFileExist($file->refe_file_path)) {&#xA;            $result[&#x27;message&#x27;] = &#x27;Missing or invalid file.&#x27;;&#xA;            return $result;&#xA;        }&#xA;&#xA;        $filePath = $file->refe_file_path;&#xA;        $fileSize = $file->content_length;&#xA;        $tempFileName = &#x27;temp-&#x27; . $file->refe_file_name;&#xA;        $ext = $file->file_type;&#xA;        $mediaCategory = &#x27;tweet_&#x27; . $file->refe_type;&#xA;        $mediaType = $file->refe_type . &#x27;/&#x27; . $ext;&#xA;        $remoteFile = file_get_contents($filePath);&#xA;        $tempFolder = public_path(&#x27;/storage/uploads/temp&#x27;);&#xA;&#xA;        if (!file_exists($tempFolder)) {&#xA;            mkdir($tempFolder, 0777, true);&#xA;        }&#xA;&#xA;        $tempFile = public_path(&#x27;/storage/uploads/temp/&#x27; . $tempFileName);&#xA;        File::put($tempFile, $remoteFile);&#xA;        $convertedFileName = &#x27;converted-&#x27; . $file->refe_file_name;&#xA;        $convertedFile = public_path(&#x27;/storage/uploads/temp/&#x27; . $convertedFileName);&#xA;        $command = &#x27;ffmpeg -y -i &#x27;.$tempFile.&#x27; -b:v 5000k -b:a 380k -c:a aac -profile:a aac_low -threads 1 &#x27;.$convertedFile.&#x27;&#x27;;&#xA;        exec($command);&#xA;        @File::delete($tempFile);&#xA;&#xA;        try {&#xA;            $twitter = Twitter::usingCredentials($requestToken[&#x27;token&#x27;], $requestToken[&#x27;secret&#x27;]);&#xA;            if ($file->refe_type === &#x27;text&#x27;) {&#xA;                $twitter->postTweet([&#xA;                    &#x27;status&#x27; => urldecode($postContent),&#xA;                    &#x27;format&#x27; => &#x27;json&#x27;,&#xA;                ]);&#xA;&#xA;                $result[&#x27;link&#x27;] = &#x27;https://twitter.com/home&#x27;;&#xA;                $result[&#x27;status&#x27;] = true;&#xA;                $result[&#x27;message&#x27;] = &#x27;Your content successfully published on Twitter. You can visit to Twitter and check it.&#x27;;&#xA;                $result[&#x27;publishing_status&#x27;] = &#x27;done&#x27;;&#xA;            } else if ($file->refe_type === &#x27;video&#x27; || $file->refe_type === &#x27;image&#x27;) {&#xA;                if ($file->refe_type === &#x27;video&#x27;) {&#xA;                    $duration = getVideoDuration($file->refe_file_path);&#xA;&#xA;                    if ($duration > config(&#x27;constant.sharing_configs.max_video_duration.twitter&#x27;)) {&#xA;                        throw new \Exception(&#x27;The duration of the video file must not exceed 140 seconds.&#x27;);&#xA;                    }&#xA;                }&#xA;&#xA;                $isFileTypeSupported = checkPublishedFileType(&#x27;twitter&#x27;, $file->refe_type, strtolower($ext));&#xA;                $isFileSizeSupported = checkPublishedFileSize(&#x27;twitter&#x27;, $file->refe_type, $fileSize, strtolower($ext));&#xA;&#xA;                if (!$isFileTypeSupported) {&#xA;                    throw new \Exception(&#x27;Your content can\&#x27;t successfully published on Twitter. This file type is not supported for publishing.&#x27;);&#xA;                }&#xA;&#xA;                if (!$isFileSizeSupported) {&#xA;                    throw new \Exception(&#x27;Your content can\&#x27;t successfully published on Twitter. The file size is exceeded.&#x27;);&#xA;                }&#xA;&#xA;                if ($file->refe_type === &#x27;video&#x27;) $fileSize = filesize($convertedFile);&#xA;&#xA;                if (strtolower($ext) === &#x27;gif&#x27;) {&#xA;                    $initMedia = $twitter->uploadMedia([&#xA;                        &#x27;command&#x27; => &#x27;INIT&#x27;,&#xA;                        &#x27;total_bytes&#x27; => (int)$fileSize&#xA;                    ]);&#xA;                } else {&#xA;                    $initMedia = $twitter->uploadMedia([&#xA;                        &#x27;command&#x27; => &#x27;INIT&#x27;,&#xA;                        &#x27;media_type&#x27; => $mediaType,&#xA;                        &#x27;media_category&#x27; => $mediaCategory,&#xA;                        &#x27;total_bytes&#x27; => (int)$fileSize&#xA;                    ]);&#xA;                }&#xA;&#xA;                $mediaId = (int)$initMedia->media_id_string;&#xA;&#xA;                $fp = fopen($convertedFile, &#x27;r&#x27;);&#xA;                $segmentId = 0;&#xA;&#xA;                while (!feof($fp)) {&#xA;                    $chunk = fread($fp, 1048576);&#xA;&#xA;                    $twitter->uploadMedia([&#xA;                        &#x27;media_data&#x27; => base64_encode($chunk),&#xA;                        &#x27;command&#x27; => &#x27;APPEND&#x27;,&#xA;                        &#x27;segment_index&#x27; => $segmentId,&#xA;                        &#x27;media_id&#x27; => $mediaId&#xA;                    ]);&#xA;&#xA;                    $segmentId&#x2B;&#x2B;;&#xA;                }&#xA;&#xA;                fclose($fp);&#xA;&#xA;                $twitter->uploadMedia([&#xA;                    &#x27;command&#x27; => &#x27;FINALIZE&#x27;,&#xA;                    &#x27;media_id&#x27; => $mediaId&#xA;                ]);&#xA;&#xA;                if ($file->refe_type === &#x27;video&#x27;) {&#xA;                    $waits = 0;&#xA;&#xA;                    while ($waits &lt;= 4) {&#xA;                        // Authorizing header for Twitter API&#xA;                        $oauth = [&#xA;                            &#x27;command&#x27; => &#x27;STATUS&#x27;,&#xA;                            &#x27;media_id&#x27; => $mediaId,&#xA;                            &#x27;oauth_consumer_key&#x27; => config(&#x27;twitter.consumer_key&#x27;),&#xA;                            &#x27;oauth_nonce&#x27; => Str::random(42),&#xA;                            &#x27;oauth_signature_method&#x27; => &#x27;HMAC-SHA1&#x27;,&#xA;                            &#x27;oauth_timestamp&#x27; => time(),&#xA;                            &#x27;oauth_token&#x27; => $requestToken[&#x27;token&#x27;],&#xA;                            &#x27;oauth_version&#x27; => &#x27;1.0&#x27;&#xA;                        ];&#xA;&#xA;                        // Generate an OAuth 1.0a HMAC-SHA1 signature for an HTTP request&#xA;                        $baseInfo = $this->buildBaseString(&#x27;https://upload.twitter.com/1.1/media/upload.json&#x27;, &#x27;GET&#x27;, $oauth);&#xA;                        // Getting a signing key&#xA;                        $compositeKey = rawurlencode(config(&#x27;twitter.consumer_secret&#x27;)) . &#x27;&amp;&#x27; . rawurlencode($requestToken[&#x27;secret&#x27;]);&#xA;                        // Calculating the signature&#xA;                        $oauthSignature = base64_encode(hash_hmac(&#x27;sha1&#x27;, $baseInfo, $compositeKey, true));&#xA;                        $oauth[&#x27;oauth_signature&#x27;] = $oauthSignature;&#xA;                        $headers[&#x27;Authorization&#x27;] = $this->buildAuthorizationHeader($oauth);&#xA;&#xA;                        try {&#xA;                            $guzzle = new GuzzleClient([&#xA;                                &#x27;headers&#x27; => $headers&#xA;                            ]);&#xA;                            $response = $guzzle->request( &#x27;GET&#x27;, &#x27;https://upload.twitter.com/1.1/media/upload.json?command=STATUS&amp;media_id=&#x27; . $mediaId);&#xA;                            $uploadStatus = json_decode($response->getBody()->getContents());&#xA;                        } catch (\Exception | GuzzleException $e) {&#xA;                            dd($e->getMessage(), $e->getLine(), $e->getFile());&#xA;                        }&#xA;&#xA;                        if (isset($uploadStatus->processing_info->state)) {&#xA;                            switch ($uploadStatus->processing_info->state) {&#xA;                                case &#x27;succeeded&#x27;:&#xA;                                    $waits = 5; // break out of the while loop&#xA;                                    break;&#xA;                                case &#x27;failed&#x27;:&#xA;                                    File::delete($tempFile);&#xA;                                    Log::error(&#x27;File processing failed: &#x27; . $uploadStatus->processing_info->error->message);&#xA;                                    throw new \Exception(&#x27;File processing failed: &#x27; . $uploadStatus->processing_info->error->message);&#xA;                                default:&#xA;                                    sleep($uploadStatus->processing_info->check_after_secs);&#xA;                                    $waits&#x2B;&#x2B;;&#xA;                            }&#xA;                        } else {&#xA;                            throw new \Exception(&#x27;There was an unknown error uploading your file&#x27;);&#xA;                        }&#xA;                    }&#xA;                }&#xA;&#xA;                $twitter->postTweet([&#x27;status&#x27; => urldecode($postContent), &#x27;media_ids&#x27; => $initMedia->media_id_string]);&#xA;                @File::delete($convertedFile);&#xA;                $result[&#x27;link&#x27;] = &#x27;https://twitter.com/home&#x27;;&#xA;                $result[&#x27;status&#x27;] = true;&#xA;                $result[&#x27;message&#x27;] = &#x27;Your content successfully published on Twitter. You can visit to Twitter and check it.&#x27;;&#xA;                $result[&#x27;publishing_status&#x27;] = &#x27;done&#x27;;&#xA;            }&#xA;        } catch (\Exception $e) {&#xA;            dd($e->getMessage());&#xA;            $result[&#x27;message&#x27;] = $e->getMessage();&#xA;            return $result;&#xA;        }&#xA;&#xA;        return $result;&#xA;    }&#xA;&#xA;    /**&#xA;     * @param $baseURI&#xA;     * @param $method&#xA;     * @param $params&#xA;     * @return string&#xA;     *&#xA;     * Creating the signature base string&#xA;     */&#xA;    protected function buildBaseString($baseURI, $method, $params): string&#xA;    {&#xA;        $r = array();&#xA;        ksort($params);&#xA;        foreach($params as $key=>$value){&#xA;            $r[] = "$key=" . rawurlencode($value);&#xA;        }&#xA;        return $method . "&amp;" . rawurlencode($baseURI) . &#x27;&amp;&#x27; . rawurlencode(implode(&#x27;&amp;&#x27;, $r));&#xA;    }&#xA;&#xA;    /**&#xA;     * @param $oauth&#xA;     * @return string&#xA;     *&#xA;     * Collecting parameters&#xA;     */&#xA;    protected function buildAuthorizationHeader($oauth): string&#xA;    {&#xA;        $r = &#x27;OAuth &#x27;;&#xA;        $values = array();&#xA;        foreach($oauth as $key=>$value)&#xA;            $values[] = "$key=\"" . rawurlencode($value) . "\"";&#xA;        $r .= implode(&#x27;, &#x27;, $values);&#xA;        return $r;&#xA;    }&#xA;}&#xA;&#xA;

    &#xA;

    I would be very grateful if someone would help me.

    &#xA;

  • MP4Box / FFMPEG concat loses audio after first clip

    17 novembre 2017, par user1615343

    So I am certainly no expert when it comes to either of these tools, but I have a web-based project that’s executing commands on an Amazon Linux server to concatenate two video files that are uploaded.

    Both files are converted to mp4s first using FFMPEG, and those play perfectly in a browser after conversion :

    ffmpeg -i file1.mpg -c:v libx264 -crf 22 -c:a aac -strict -2 -movflags faststart file2.mp4

    Then, I attempt to combine these two resulting mp4s into a single mp4. I tried using FFMPEG to do this but to no avail. Switching to try MP4Box got me much closer : the videos are concatenated together, but the audio stops playing at the end of the first clip, and the second clip is silent.

    MP4Box -force-cat -keepsys -add file.mp4 -cat file2.mp4 out.mp4

    I’ve tried varying versions of the above command with no better results. Any input is greatly appreciated.

    EDIT : info on .mp4 files using

    ffmpeg -i file1.mp4 -i file2.mp4

    ffmpeg -i 1510189259715DogRunsintoGlassDoor_315a03a8e20acfc.mp4 -i
    1510189273549NewhouseMoonMoonneverseenstairsbeforefunnydog_285a03a8e6aab25.mp4

    ffmpeg version N-61041-g52a2138 Copyright (c) 2000-2014 the FFmpeg
    developers

    built on Mar 2 2014 05:45:04 with gcc 4.6 (Debian 4.6.3-1)

    configuration : —prefix=/root/ffmpeg-static/64bit
    —extra-cflags=’-I/root/ffmpeg-static/64bit/include -static’ —extra-ldflags=’-L/root/ffmpeg-static/64bit/lib -static’ —extra-libs=’-lxml2 -lexpat -lfreetype’ —enable-static —disable-shared —disable-ffserver —disable-doc —enable-bzlib —enable-zlib —enable-postproc —enable-runtime-cpudetect —enable-libx264 —enable-gpl —enable-libtheora —enable-libvorbis —enable-libmp3lame —enable-gray —enable-libass —enable-libfreetype —enable-libopenjpeg —enable-libspeex —enable-libvo-aacenc —enable-libvo-amrwbenc —enable-version3 —enable-libvpx

    libavutil 52. 66.100 / 52. 66.100

    libavcodec 55. 52.102 / 55. 52.102

    libavformat 55. 33.100 / 55. 33.100

    libavdevice 55. 10.100 / 55. 10.100

    libavfilter 4. 2.100 / 4. 2.100

    libswscale 2. 5.101 / 2. 5.101

    libswresample 0. 18.100 / 0. 18.100

    libpostproc 52. 3.100 / 52. 3.100

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
    ’1510189259715DogRunsintoGlassDoor_315a03a8e20acfc.mp4’ :

    Metadata :

    major_brand : isom

    minor_version : 512

    compatible_brands : isomiso2avc1mp41

    encoder : Lavf55.33.100

    Duration : 00:00:04.92, start : 0.023220, bitrate : 634 kb/s

    Stream #0:0(und) : Video : h264 (High) (avc1 / 0x31637661), yuv420p,
    360x360 [SAR 1:1 DAR 1:1], 501 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
    (default)

    Metadata :

    handler_name : VideoHandler

    Stream #0:1(und) : Audio : aac (mp4a / 0x6134706D), 44100 Hz, mono,
    fltp, 132 kb/s (default)

    Metadata :

    handler_name : SoundHandler

    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from
    ’1510189273549NewhouseMoonMoonneverseenstairsbeforefunnydog_285a03a8e6aab25.mp4’ :

    Metadata :

    major_brand : isom

    minor_version : 512

    compatible_brands : isomiso2avc1mp41

    encoder : Lavf55.33.100

    Duration : 00:00:18.79, start : 0.023220, bitrate : 455 kb/s

    Stream #1:0(und) : Video : h264 (High) (avc1 / 0x31637661), yuv420p,
    362x360 [SAR 1:1 DAR 181:180], 320 kb/s, 29.94 fps, 29.94 tbr, 11976
    tbn, 59.88 tbc (default)

    Metadata :

    handler_name : VideoHandler

    Stream #1:1(eng) : Audio : aac (mp4a / 0x6134706D), 44100 Hz, stereo,
    fltp, 129 kb/s (default)

    Metadata :

    handler_name : SoundHandler

    At least one output file must be specified

  • Reason for write EPIPE error in my implentation ?

    18 mai 2019, par Chrisl446

    So I currently have a small node.js express application for uploading images using sharp & thumbnails created from .mp4 videos using simple-thumbnail package/ffmpeg.

    The app works perfectly when uploading an image, the file is uploaded sharp processes it, then passes it along and it ends up in my amazon s3 bucket as expected. No errors what so ever.

    However, when I upload an mp4 video that I use to create and upload a thumbnail from by using simple-thumbnails genThumbnail() function, which uses ffmpeg child process, the thumbnail uploads successully to my s3 bucket, HOWEVER my app returns an EPIPE write error and NOT the url of the uploaded files url on S3.

    What is causing this and how can I fix it, considering it’s pretty much working aside from the EPIPE error that is being returned ? Thanks ahead !

    The packages of concern used are as follows :

    aws-sdk

    multer

    multer-s3 <- this one with the transform option, not the standard multer-s3 package

    simple-thumbnail

    const express = require('express');
    const app = express();

    const aws = require('aws-sdk');
    const multer = require('multer');
    const multerS3 = require('multer-s3'); //github:gmenih341/multer-s3 version of multer-s3 with transform option
    const sharp = require('sharp');
    const genThumbnail = require('simple-thumbnail');

    app.use((req, res, next) => {
       res.header('Access-Control-Allow-Origin', '*');
       res.header('Access-Control-Allow-Headers', 'Orgin, X-Requested-With, Content-Type, Accept, Authorization');
       if (req.method === 'OPTIONS') {
           res.header('Access-Control-Allow-Methods', 'POST');
           return res.status(200).json({});
       }
       next();
    });

    let uniqueFileName;
    let s3BucketName = 'bucketname';

    let s3 = new aws.S3({
       accessKeyId: ACCESS_KEY,
       secretAccessKey: SECRET_KEY,
       Bucket: s3BucketName
    });

    let upload = multer({
       storage: multerS3({
           s3: s3,
           bucket: s3BucketName,
           acl: 'public-read',
           cacheControl: 'max-age=31536000',
           contentType: multerS3.AUTO_CONTENT_TYPE,
           shouldTransform: true,
           transforms: [{
               id: 'thumbnail',
               key: function (req, file, cb) {
                   uniqueFileName = Date.now().toString();
                   cb(null, uniqueFileName + '.jpg')
               },
               transform: function (req, file, cb) {
                   if (file.mimetype == 'video/mp4') {
                       //When using simple-thumbnails' getThumbnail() on an mp4 video it uploads succesfully to S3 but node returns EPIPE write error
                       cb(null, genThumbnail(null, null, '250x?'))
                   } else {
                       //When using sharp to resize an image this works perfectly and retuns the JSON below with the files S3 URL
                       cb(null, sharp().jpeg())
                   }

               }
           }]
       })
    });

    app.post('/upload', upload.array('theFile'), (req, res) => {
       res.json({
           fileS3Url: 'https://s3.amazonaws.com/'+ s3BucketName +'/' + uniqueFileName
       });
    });

    app.use((req, res, next) => {
       const error = new Error('Not found');
       error.status = 404;
       next(error);
    });

    app.use((error, req, res, next) => {
       res.status(error.status || 500);
       res.json({
           error: {
               message: error.message
           }
       });
    });

    module.exports = app;