Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (74)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (7144)

  • couldn't populate thumbnail on client side

    8 novembre 2020, par Loki
    router.post("/thumbnail",(req,res)=>{

  let thumbsFilePath="";
  let fileDuration="";



  ffmpeg.ffprobe(req.body.filePath, function(err,metadata){
    console.dir(metadata);
    console.log('METADATA==>'+metadata);
    console.log(metadata.format.duration);

    fileDuration=metadata.format.duration;

  })

  
  ffmpeg(req.body.filePath)
  .on('filenames', function(filenames) {
    console.log('Will generate ' + filenames.join(','))
    thumbsFilePath="uploads/thumbnails/"+ filenames[0];
  })
  .on('end', function() {
    console.log('Screenshots taken');
    console.log('FILEPATH===>'+thumbsFilePath);
    console.log('FILEDURATION===>'+fileDuration);
    return res.json({success: true, thumbsFilePath , fileDuration})
  })
  .screenshots({
    // Will take screens at 20%, 40%, 60% and 80% of the video
    count: 3,
    folder: 'uploads/thumbnails/',
    size:'320x240',
    // %b input basename ( filename w/o extension )
    filename:'thumbnail-%b.png'
  });
})


    


    the screenshots are saved perfectly and their path is also received to the client-side from thumbsFilePath but I cant populate it in the client-side page(react).. idk what I am doing wrong here.

    


    here is client-side code. I used usestate

    


      const [FilePath, setFilePath]= useState('');
  const [Duration, setDuration] = useState('');
  const [Thumbnail, setThumbnail] = useState('');


    


    here is an error when I try to populate img

    


    enter image description here

    


    const onDrop=(files)=>{&#xA;      let formData= new FormData();&#xA;      let config={&#xA;        header:{&#x27;content-type&#x27;:&#x27;multipart/form-data&#x27;}&#xA;      }&#xA;      &#xA;      formData.append("file",files[0])&#xA;      Axios.post(&#x27;http://localhost:5000/api/video/uploadFiles&#x27;,formData,config)&#xA;      .then(response=>{&#xA;        console.log(response);&#xA;     if(response.data.success){&#xA;       console.log(&#x27;FILEPATH==>&#x27;&#x2B;response.data.filePath);&#xA;       console.log(&#x27;filename==>&#x27;&#x2B;response.data.fileName);&#xA;      let variable={&#xA;        filePath:response.data.filePath,&#xA;        fileName:response.data.fileName&#xA;      }&#xA;      setFilePath(response.data.filePath);&#xA;      Axios.post(&#x27;http://localhost:5000/api/video/thumbnail&#x27;,variable)&#xA;      .then(response=>{&#xA;        if(response.data.success){&#xA;          setDuration(response.data.fileDuration)&#xA;          setThumbnail(response.data.thumbsFilePath)&#xA;        }else{&#xA;          alert("failed to make thumbnails");&#xA;        }&#xA;      })&#xA;     }&#xA;      }).catch(err=>{&#xA;        console.log(&#x27;error&#x27;&#x2B;err);&#xA;      })&#xA;  }&#xA;  &#xA;    return (&#xA;      &lt;>&#xA;        <form>&#xA;        <dropzone>&#xA;  {({getRootProps, getInputProps}) => (&#xA;    <section>&#xA;      <div classname="dropzone__container">&#xA;        <input />&#xA;        <p>Drag &#x27;n&#x27; drop some files here, or click to select files</p>&#xA;      </div>&#xA;    </section>&#xA;  )}&#xA;</dropzone>&#xA; &#xA;    {Thumbnail !== "" &amp;&amp;&#xA;     <div>&#xA;       <img src="http://stackoverflow.com/feeds/tag/{`http:/localhost:5000/server/${Thumbnail}`}" alt="haha" style='max-width: 300px; max-height: 300px' />&#xA;     </div>&#xA;    }&#xA;&#xA;{data: {…}, status: 200, statusText: "OK", headers: {…}, config: {…},&#xA0;…}config: {url: "http://localhost:5000/api/video/uploadFiles", method: "post", data: FormData, headers: {…}, transformRequest: Array(1),&#xA0;…}data: {success: true, fileName: "SampleVideo_1280x720_1mb.mp4", filePath: "uploads\SampleVideo_1280x720_1mb.mp4"}headers: {content-length: "109", content-type: "application/json; charset=utf-8"}request: XMLHttpRequest&#xA0;{readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, onreadystatechange: ƒ,&#xA0;…}status: 200statusText: "OK"__proto__: Object&#xA;UploadVideo.js:51 FILEPATH==>uploads\SampleVideo_1280x720_1mb.mp4&#xA;UploadVideo.js:52 filename==>SampleVideo_1280x720_1mb.mp4&#xA;thumbnail-SampleVideo_1280x720_1mb_1.png:1 GET http://localhost:5000/server/uploads/thumbnails/thumbnail-SampleVideo_1280x720_1mb_1.png 404 (Not Found)&#xA;but the thumbnail is in that directory..but it says not found.and it shows the "alt"(haha) in browser.`enter code here`&#xA;(C:\Users\chidori\Desktop\project\server\uploads\thumbnails\thumbnail-SampleVideo_1280x720_1mb_1.png).&#xA;</form>

    &#xA;

    sorry for messy presentation..

    &#xA;

  • FFMPEG on AWS Lambda works selectively

    20 novembre 2020, par Arindam Baral

    I am using FFMpeg on AWS Lambda to convert mp4 files to m3u8 format.

    &#xA;

    Here's my code :

    &#xA;

    ENCODE_SIZE = {&#xA;    &#x27;360p&#x27;: (&#x27;360:640&#x27;, &#x27;1000000&#x27;),&#xA;    &#x27;540p&#x27;: (&#x27;540:960&#x27;, &#x27;2000000&#x27;),&#xA;    &#x27;720p&#x27;: (&#x27;720:1280&#x27;, &#x27;5000000&#x27;)&#xA;}&#xA;@app.route(&#x27;/encode&#x27;, methods=[&#x27;GET&#x27;])&#xA;@token_required&#xA;def encodeVideo(current_user):&#xA;    try:&#xA;        userEmail = current_user.emailID&#xA;        &#xA;        courseID = request.args.get(&#x27;courseID&#x27;)&#xA;        fileKey = request.args.get(&#x27;fileKey&#x27;)&#xA;        print (&#x27;Input file key received &#x27;, fileKey)&#xA;        convType = &#x27;all&#x27;&#xA;        if &#x27;convType&#x27; in request.args:&#xA;            convType = request.args.get(&#x27;convType&#x27;)&#xA;        print (&#x27;Conv Type::::&#x27;, convType)&#xA;        instiID = Course.query.filter_by(id=courseID).first().instiID&#xA;        adminEmail = Institute.query.filter_by(id=instiID).first().adminEmail&#xA;        if adminEmail != userEmail:&#xA;            return jsonify({&#x27;message&#x27;: &#x27;Not authorized&#x27;}), 403&#xA;        &#xA;        bucket = app.config[&#x27;S3_CONTENT_FOLDER&#x27;]&#xA;        folder = &#x27;/&#x27;.join(fileKey.split(&#x27;/&#x27;)[:-1])&#xA;        &#xA;        os.system(&#x27;cp /var/task/ffmpeg /tmp/; chmod 755 /tmp/ffmpeg;&#x27;)&#xA;        FFMPEG_STATIC = &#x27;/tmp/ffmpeg&#x27; #"/opt/bin/ffmpeg" # &#xA;        # FFMPEG_STATIC = &#x27;ffmpeg&#x27; #"/opt/bin/ffmpeg" # &#xA;        &#xA;        preSignURL = getPreSignedS3URL(fileKey, bucket)&#xA;        print (preSignURL)&#xA;        &#xA;        outputFlag = []&#xA;        &#xA;        # outFileName = &#x27;final_out.m3u8&#x27;&#xA;        outFileName = &#x27;/tmp/final_out.m3u8&#x27;&#xA;        with open(outFileName, &#x27;a&#x27;) as outFile:&#xA;            outFile.write(&#x27;#EXTM3U\n&#x27;)&#xA;            &#xA;            if convType == &#x27;all&#x27;:&#xA;                for ver in ENCODE_SIZE:&#xA;                    print (&#x27;Starting for ver &#x27;, ver)&#xA;                    outFileNameM3 = &#x27;/tmp/%s_out.m3u8&#x27; %(ver) &#xA;                    # outFileNameM3 = &#x27;%s_out.m3u8&#x27; %(ver) &#xA;                    &#xA;                    subprocess.call([FFMPEG_STATIC, &#x27;-i&#x27;, preSignURL, &#x27;-c:a&#x27;, &#x27;aac&#x27;, &#x27;-c:v&#x27;, &#x27;libx264&#x27;, &#x27;-s&#x27;, ENCODE_SIZE[ver][0], &#x27;-f&#x27;, &#x27;hls&#x27;, &#x27;-hls_list_size&#x27;, &#x27;0&#x27;, &#x27;-hls_time&#x27;, &#x27;10&#x27;, outFileNameM3])&#xA;                    &#xA;                    outFile.write(&#x27;#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=%s %s\n&#x27; %(&#xA;                        ENCODE_SIZE[ver][1], outFileName&#xA;                    ))&#xA;                    # ret = os.system(commandStr)&#xA;                    # outputFlag.append(ret)&#xA;                    print (&#x27;Encoding completed for ver &#x27;, ver)&#xA;            else:&#xA;                ver = convType&#xA;                outFileNameM3 = &#x27;/tmp/%s_out.m3u8&#x27; %(ver) &#xA;                # outFileNameM3 = &#x27;%s_out.m3u8&#x27; %(ver) &#xA;&#xA;                subprocess.call([FFMPEG_STATIC, &#x27;-i&#x27;, preSignURL, &#x27;-c:a&#x27;, &#x27;aac&#x27;, &#x27;-c:v&#x27;, &#x27;libx264&#x27;, &#x27;-s&#x27;, ENCODE_SIZE[ver][0], &#x27;-f&#x27;, &#x27;hls&#x27;, &#x27;-hls_list_size&#x27;, &#x27;0&#x27;, &#x27;-hls_time&#x27;, &#x27;10&#x27;, outFileNameM3])  &#xA;                    &#xA;                outFile.write(&#x27;#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=%s %s\n&#x27; %(&#xA;                        ENCODE_SIZE[ver][1], outFileName&#xA;                ))&#xA;                # ret = os.system(commandStr)&#xA;                # outputFlag.append(ret)&#xA;        outFile.close()&#xA;        print (&#x27;File Key Generated&#x27;)&#xA;        #Upload files to s3&#xA;        streamFiles = glob.glob(&#x27;/tmp/*.ts&#x27;)&#xA;        print (streamFiles)&#xA;        for fl in streamFiles:&#xA;            finFileName = fl.split(&#x27;/&#x27;)[-1]&#xA;            fileKeyName = folder &#x2B; &#x27;/&#x27; &#x2B; finFileName&#xA;            uploadFileToS3(fl, fileKeyName, app.config[&#x27;S3_CONTENT_FOLDER&#x27;])&#xA;        # m3u8Files = glob.glob(&#x27;/tmp/*.m3u8&#x27;)&#xA;        # print (m3u8Files)&#xA;        # for fl in m3u8Files:&#xA;        #     finFileName = fl.split(&#x27;/&#x27;)[-1]&#xA;        #     fileKeyName = folder &#x2B; &#x27;/&#x27; &#x2B; finFileName&#xA;        #     uploadFileToS3(fl, fileKeyName, app.config[&#x27;S3_CONTENT_FOLDER&#x27;])&#xA;        # print (&#x27;S3 upload completed&#x27;)&#xA;        &#xA;        # files = glob.glob(&#x27;/tmp/*&#x27;)&#xA;        # for f in files:&#xA;        #     os.remove(f)&#xA;        return jsonify({&#x27;message&#x27;: &#x27;Completed file encoding&#x27;}), 201&#xA;    except:&#xA;        print (traceback.format_exc())&#xA;        return jsonify({&#x27;message&#x27;: &#x27;Error in encoding file&#x27;}), 504&#xA;if __name__ == &#x27;__main__&#x27;:&#xA;    app.run(debug=True,host="0.0.0.0", port=5000)&#xA;&#xA;

    &#xA;

    When I request for "540p", the m3u8 file gets converted perfectly.&#xA;However, when I request for "360p" and "720p", I see only the first 1 second of the video.

    &#xA;

    Please note - All the tls files are generated in all the cases. The problem is only in creation of the m3u8 playlist file.

    &#xA;

    Can someone please help in this regard ?

    &#xA;

    EDIT 1 : I am quite new to FFMPEG. So any help here will be very welcome

    &#xA;

    The log files are present here :&#xA;https://drive.google.com/file/d/1QFgi-4jDIN3f6mWLoR999mlXzZ-Ij83R/view?usp=sharing

    &#xA;

  • scripting massive number of files with ffmpeg [closed]

    2 décembre 2020, par 8Liter

    Alright, I've got over 5000 MP4 files in a single directory that I would ultimately like to process using ffmpeg. I've got a few different solutions that all work by themselves, but put together do not make my job any easier.&#xA;The current file list looks like this, in one single directory :

    &#xA;

      &#xA;
    • 10-1.mp4
    • &#xA;

    • 10-2.mp4
    • &#xA;

    • 10123-1.mp4
    • &#xA;

    • 10123-2.mp4
    • &#xA;

    • 10123-3.mp4
    • &#xA;

    • 10123-4.mp4
    • &#xA;

    • 10123-5.mp4
    • &#xA;

    • 10123-6.mp4
    • &#xA;

    • 102-1.mp4
    • &#xA;

    • 103-1.mp4
    • &#xA;

    • 103-2.mp4
    • &#xA;

    • 103-3.mp4
    • &#xA;

    • 107-1.mp4
    • &#xA;

    • 107-2.mp4
    • &#xA;

    • 107-3.mp4
    • &#xA;

    • 107-4.mp4
    • &#xA;

    • 107-5.mp4
    • &#xA;

    • 107-6.mp4
    • &#xA;

    • 11-1.mp4
    • &#xA;

    • 11-2.mp4
    • &#xA;

    &#xA;

    The ideal process I would like is the following :

    &#xA;

    A. Take however many files in the directory have a particular prefix, for example the two "11" files at the bottom, and concatenate them into a single MP4 file. The end result is a single "11.MP4"

    &#xA;

    B. Delete the original two "11-1.mp4" and "11-2.mp4", keeping only the new "11.mp4" complete file.

    &#xA;

    C. Repeat steps A-B for all other files in this directory

    &#xA;

    This is not apparently possible right now from what I can glean from other threads, but I've tested a more manual approach which is not clean OR fast, and this is what my workflow looks like in real life...

    &#xA;

      &#xA;
    1. move files with same prefix into new folder (I have a working bat file that will do this for me)
    2. &#xA;

    3. run a ffmpeg bat file to process an "output.mp4" file (I have a working bat file that will do this for me)
    4. &#xA;

    5. delete the original files
    6. &#xA;

    7. rename the output.mp4 file to the prefix name (i.e. 11.mp4)
    8. &#xA;

    9. copy that file back into the new directory
    10. &#xA;

    11. repeat steps 1-5 a thousand times.
    12. &#xA;

    &#xA;

    I've also looked into creating all new directories BASED on the filename (I have a working bat file that will do this for me) and then copy my ffmpeg bat file into each directory, and run each bat file manually... but again it's a ton of work.

    &#xA;

    (FROM STEP 1 ABOVE)

    &#xA;

    @echo off&#xA;setlocal&#xA;&#xA;set "basename=."&#xA;for /F "tokens=1* delims=.*" %%a in (&#x27;dir /B /A-D ^| sort /R&#x27;) do (&#xA;   set "filename=%%a"&#xA;   setlocal EnableDelayedExpansion&#xA;   for /F "delims=" %%c in ("!basename!") do if "!filename:%%c=!" equ "!filename!" (&#xA;      set "basename=!filename!"&#xA;      md "!basename!"&#xA;   )&#xA;   move "!filename!.%%b" "!basename!"&#xA;   for /F "delims=" %%c in ("!basename!") do (&#xA;      endlocal&#xA;      set "basename=%%c&#xA;&#xA;   )&#xA;)&#xA;

    &#xA;

    (FROM STEP 2 ABOVE)

    &#xA;

    :: Create File List&#xA;del "F:\videos\*.txt" /s /f /q&#xA;for %%i in (*.mp4) do echo file &#x27;%%i&#x27;>> mylist.txt&#xA;&#xA;:: Concatenate Files&#xA;ffmpeg.exe -f concat -safe 0 -i mylist.txt -c copy output.mp4&#xA;

    &#xA;

    Any ideas how I can approach this ? I'm open to powershell, batch, even python if I need to.

    &#xA;