Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (47)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (7602)

  • streaming an mkv file while processing with ffmpeg

    2 avril 2019, par Phani Rithvij

    What I want to do :

    • I want to play an mkv video in Firefox.
    • But Firefox doesn’t support the mkv format.

    So I’ve searched a lot and found that,
    I could stream instead of playing the video following these steps.

    • mkv can be converted to an m3u8 using FFmpeg
    • The m3u8 points towards ts segment files
    • then use hls.js on the browser side to play the video

    But the catch is I want to do this programmatically.

    What I actually want to do :

    Steps

    • the client uploads a huge (>1 GB) mkv file to the client’s server (server is the client’s machine itself)

    • after the upload is done,

    • client requests to play the video.

    • the server starts transcoding and sends the client the m3u8 stream immediately instead of making the client wait for the transcoding to complete.

    • the client should be able to seek the video. (the most IMPORTANT part)

    It is possible as Emby and Plex both have implemented it.

    I was able to get this to work in chrome as it supports playing some mkv files.
    I wrote a node js server that accepts Range header and pseudo-streams the video.

    A gist

    But as I’ve mentioned Firefox says NO to mkv.

    So I tried the hls thing but I couldn’t quite get the command to generate the stream and also play on the fly.

    I started this on a command line

    ffmpeg -i ../stream.mkv -hls_list_size 0 -acodec copy -vcodec copy file.m3u8

    and a simple http-server on another shell instance

    My index.html file

       
       
           <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/hls.js'&gt;&lt;/script&gt;

    &lt;script&gt;<br />
               var video = document.getElementById('video');<br />
               if(Hls.isSupported()) {<br />
                   var hls = new Hls();<br />
                   hls.loadSource('file.m3u8');<br />
                   hls.attachMedia(video);<br />
                   hls.on(Hls.Events.MANIFEST_PARSED,function() {<br />
                       video.play();<br />
                   });<br />
               } else if (video.canPlayType('application/vnd.apple.mpegurl')) {<br />
                   video.src = 'file.m3u8';<br />
                   video.addEventListener('loadedmetadata',function() {<br />
                       video.play();<br />
                   });<br />
               }<br />
           &lt;/script&gt;

    and while it was running I went ahead and requested the server.

    I was able to get the video but It only seeks as far it’s converted into the ts files.

    And it’s random and the video length keeps increasing. It won’t play sometimes and after the FFmpeg is done converting to m3u8 the video plays if I refresh the webpage.

    I think this has to do with the continuous overwriting of the m3u8 file.
    is there a way to predetermine the file contents of m3u8 and fill it up ?

    I want to be able to seek even further and somehow spawn another FFmpeg process
    to start from that timestamp of the video ? How could I approach the seeking part ?

    So what I’d like to do again is

    • I want to request the server to play a video file
    • It spawns a child process FFmpeg that does the transcoding
    • Sends the client the stream
    • The client should be able to seek to the end and it should play the thing.
  • HEVC to mp4 video converter

    7 juillet 2023, par Rahul Ranjan

    While converting files HEVC to mp4 using python the error is comming by ffmpeg. I have used moviepy to convert video to mp4 formate.

    &#xA;

    Used moviepy Package to convert but throwing error

    &#xA;

    import os&#xA;from moviepy.editor import VideoFileClip&#xA;&#xA;def convert_to_mp4(input_file, output_file):&#xA;    try:&#xA;        clip = VideoFileClip(input_file)&#xA;        codec = &#x27;libx264&#x27;  # Default codec is libx264&#xA;        if clip.reader.codec_name == &#x27;hevc&#x27;:&#xA;            codec = &#x27;libx265&#x27;&#xA;        clip.write_videofile(output_file, codec=codec, audio_codec=&#x27;aac&#x27;)&#xA;        return True&#xA;    except Exception as e:&#xA;        print(f"Error converting video: {str(e)}")&#xA;        return False&#xA;&#xA;def upload_and_convert(input_file_path, output_folder):&#xA;    if os.path.exists(input_file_path):&#xA;        # Convert to MP4&#xA;        mp4_file_path = os.path.join(output_folder, &#x27;converted2.mp4&#x27;)&#xA;        success = convert_to_mp4(input_file_path, mp4_file_path)&#xA;&#xA;        if success:&#xA;            print(f"Conversion successful. MP4 saved at {mp4_file_path}")&#xA;            return mp4_file_path  # Return the path of the converted MP4 file&#xA;        else:&#xA;            print("Failed to convert the video.")&#xA;            return None&#xA;    else:&#xA;        print("Input file not found.")&#xA;        return None&#xA;&#xA;input_file_path = &#x27;/Downloads/sample-hevc-file.hevc&#x27;&#xA;output_folder = &#x27;/Downloads&#x27;&#xA;download_link = upload_and_convert(input_file_path, output_folder)&#xA;&#xA;if download_link:&#xA;    print(f"Download the converted MP4 file here: {download_link}")&#xA;

    &#xA;

    Error

    &#xA;

    rror converting video: MoviePy error: failed to read the duration of file C:/Users/kjrah/Downloads/sample-hevc-file.hevc.&#xA;Here are the file infos returned by ffmpeg:&#xA;&#xA;ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with gcc 9.2.1 (GCC) 20200122&#xA;  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, hevc, from &#x27;C:/Users/kjrah/Downloads/sample-hevc-file.hevc&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;    Stream #0:0: Video: hevc (Main), yuv420p(tv), 320x240 [SAR 1:1 DAR 4:3], 15 fps, 15 tbr, 1200k tbn, 15 tbc&#xA;At least one output file must be specified&#xA;&#xA;Failed to convert the video.&#xA;

    &#xA;

    Throwing this error except HEVC mostly files are working fine.

    &#xA;

  • Translating code snippet function from c++ to python, using ffmpeg to crop imageFile [closed]

    5 octobre 2022, par Minai

    The code above is written in C++. It takes an input image file and crops its imageHeight and Width using ffmpeg libray, and saves the output image fractures to a txt file. I want the same code written in python. The fractures are saved using the new name of the original file plus the crop size to differentiate each image grid.

    &#xA;

    void shatterImages(string imagefiles, int imgWidth, int imgHeight, &#xA;    int cropSizeW, int cropSizeH)&#xA;{&#xA;    cout &lt;&lt; "Calculating subimage fractures for " &lt;&lt; imagefiles &lt;&lt; " fullframe images..." &lt;&lt; endl;&#xA;    if(!imagefiles.isnull()){&#xA;        string outputCommand="";&#xA;        int i,j;&#xA;        ofstream myfile2 ("outputfile.txt");&#xA;        if (myfile2.is_open()) {&#xA;                //cout &lt;&lt; "Fracturing: " &lt;&lt; imagefiles &lt;&lt; endl;&#xA;                outputCommand = "ffmpeg";&#xA;                for (i = 0; i &lt; ceil(imgWidth / (0.0&#x2B;cropSizeW)); i &#x2B;= 1)  //loop vert over image&#xA;                {&#xA;                    for (j = 0; j &lt; ceil(imgHeight / (0.0&#x2B;cropSizeH)); j &#x2B;= 1)  //loop horizontally over image&#xA;                    {&#xA;                        //replace shattered images from fullframes to subframes&#xA;                         outputCommand &#x2B;=&#xA;                                " -i " &#x2B; imagefiles &#x2B; " -qscale:v 1 -vf \"crop=" &#x2B; to_string(cropSizeW) &#x2B; ":" &#x2B;&#xA;                                to_string(cropSizeH) &#x2B; ":" &#x2B; to_string(i * cropSizeW) &#x2B; ":" &#x2B; to_string(j * cropSizeH) &#x2B;&#xA;                                "\" " &#x2B; imagefiles.substr(0, imagefiles.length() - 4) &#x2B; "-" &#x2B;&#xA;                                to_string(i * cropSizeW) &#x2B; "-" &#x2B; to_string(j * cropSizeH) &#x2B; ".jpg";&#xA;                    }&#xA;                }&#xA;                //print(outputCommand)&#xA;                myfile2 &lt;&lt; outputCommand &lt;&lt; endl;&#xA;            myfile2.close();&#xA;            cout &lt;&lt; "Finished writing to: fractureAllImages.sh" &lt;&lt; endl;&#xA;        }&#xA;        else&#xA;            cout &lt;&lt; "Unable to open output file for: fractureAllImages.sh" &lt;&lt; endl;&#xA;    }&#xA;}&#xA;

    &#xA;

    I Transalted into python like this but I am getting an error :

    &#xA;

    import csv&#xA;from csv import reader, writer&#xA;from math import ceil&#xA;import string&#xA;&#xA;#Using context managers to open file&#xA;with open ("coral.txt", &#x27;w&#x27;) as infile:&#xA;    outputFile = writer(infile)&#xA;&#xA;    # writes to the file&#xA;    #infile.write(&#x27;Test me, 123, abc, xyz&#x27;)&#xA;&#xA;    &#xA;#creating the main fucntion&#xA;def coral (imageFiles, imageWidth, imageHeight, cropWidth, cropHeight):&#xA;    print("calculating the subimage fractures for", imageFiles, "full frame images")&#xA;    &#xA;    if imageFiles != None:&#xA;        def outputCommand (i, j):&#xA;            outputFile.write("coral.txt")&#xA;            if (infile is open):&#xA;                print ("fracturing:", imageFiles)&#xA;                outputCommand = "ffmpeg"&#xA;            &#xA;                #looping vertically over the image&#xA;                for (i = 0, i &lt; ceil(imageWidth/(0.0&#x2B;cropWidth), i&#x2B;&#x2B;)){&#xA;&#xA;                    #Looping horizontally over the image&#xA;                    for (int j = 0; j(0.0&#x2B;cropWidth); j&#x2B;&#x2B;)){&#xA;&#xA;                        #replace shattered images from fullframes to subframes and saving&#xA;                        outputCommand &#x2B;= " -i " &#x2B; imageFiles &#x2B; " -qscale:v 1 -vf \"crop=" &#x2B; to_string(cropWidth) &#x2B; ":" &#x2B; to_string(cropHeight) &#x2B; ":" &#x2B; to_string(i * cropWidth) &#x2B; ":" &#x2B; to_string(j * cropHeight) &#x2B; "\" " &#x2B; imageFiles.substr(0, imageFiles.length() - 4) &#x2B; "-" &#x2B; to_string(i * cropWidth) &#x2B; "-" &#x2B; to_string(j * cropHeight) &#x2B; ".jpg";&#xA;                &#xA;                    }&#xA;&#xA;                }&#xA;&#xA;&#xA;    &#xA;                #printing to the file coral.txt&#xA;                infile(outputCommand)&#xA;            infile.close() &#xA;            print("Finnished writing to text file")&#xA;    &#xA;&#xA;    else:&#xA;        print("Unable to open output file for fracturing")&#xA;&#xA;&#xA;#remember to close opened files&#xA;outputFile.close()&#xA;                &#xA;    &#xA;    &#xA;    &#xA;   &#xA;

    &#xA;