Recherche avancée

Médias (91)

Autres articles (36)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Librairies et logiciels spécifiques aux médias

    10 décembre 2010, par

    Pour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
    Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (8067)

  • Video tube site on wordpress dedicated server mp4 only streams on android firefox

    9 mai 2015, par Steven Minix

    I have a video tube site that is quite popular and I am having an issue with my mp4 files streaming on android devices. When using Mozilla Firefox on android my videos play and seek perfectly. When using google chrome or default Android browser they do not play at all. I ran one of my videos through mp4box with a few settings and I got it to play on those browser in Android but they break when trying to seek. So at this stage the videos still play fine on Firefox in Android but now even though the video will start playing rather quickly on the other two browsers the videos will not seek properly as seeking will cause the video to break and restart itself. I am in a wordpress installation on a dedicated server.

    server specs:
    PHP 5.2.4 or greater
    MySQL 5.0 or greater
    PHP cURL extension
    PHP Zlib extension
    Unix-like OS (Windows is not supported)
    PHP 5.3, 5.4, 5.5 yes
    IonCube Loader 4.6.1 or above yes
    Mysql 5.0 or above and its support in PHP yes
    FFmpeg 1.0 or above with libx264, libavfilter and AAC codec (libfaac, libfdk_aac or native ffmpeg aac codec) yes
    cURL and its support in PHP yes
    Apache + mod_rewrite + (MultiViews option disabled) yes, not sure about multi views, please ask how this is done.
    Zlib library yes
    XML extension yes
    GD2 with true type font (required!) yes
    Ability to exec PHP from CLI using exec() command yes
    PHP register_globals off yes
    PHP magic_quotes_gpc off yes
    PHP safe_mode off yes
    PHP file_uploads on yes
    PHP allow_url_fopen on yes

    The files are MP4 with the meta data at the front of the file and playing in the standard wordpress video player(or any html5 based player as I have tried quite a few and all have the same result)

    I had to ask my server admin to install ffmpeg for my streaming is it possible they did not add the right commands ?

    I have no idea what my videos are doing on Apple devices but I assume it is okay since Google Analytics shows a low bounce rate from that devices.

    If any issue is on service side I want to contact them armed with facts. I appreciate your help in this matter.

    EDIT : FFMPEG SERVER CONFIGURATION :
    root@dwhsv160 [ /ffmpeginstaller.8.0]# ffmpeg -version
    ffmpeg version N-71403-g415f1fa-syslint Copyright (c) 2000-2015 the FFmpeg developers
    built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
    configuration : —prefix=/usr/local/cpffmpeg —enable-shared —enable-nonfree —enable-gpl —enable-pthreads —enable-libopencore-amrnb —enable-decoder=liba52 —enable-libopencore-amrwb —enable-libfaac —enable-libmp3lame —enable-libtheora —enable-libvorbis —enable-libx264 —enable-libxvid —extra-cflags=-I/usr/local/cpffmpeg/include/ —extra-ldflags=-L/usr/local/cpffmpeg/lib —enable-version3 —extra-version=syslint
    libavutil 54. 22.101 / 54. 22.101
    libavcodec 56. 34.100 / 56. 34.100
    libavformat 56. 30.100 / 56. 30.100
    libavdevice 56. 4.100 / 56. 4.100
    libavfilter 5. 13.101 / 5. 13.101
    libswscale 3. 1.101 / 3. 1.101
    libswresample 1. 1.100 / 1. 1.100
    libpostproc 53. 3.100 / 53. 3.100

    The few things I tried with the mp4 that got them to play but still not seek properly were running them through mp4box with no special settings and simply remuxing them. I also tried a couple special settings like adding a hint track and other things none resulted in the file streaming properly in chrome or default android browser. AGAIN my files stream fine on all desktops and in FIREFOX on android but DO NOT work in chrome on android or default android browser.

  • How to batch process a series of video files with powershell and other-transcode/ffmpeg

    7 juin 2022, par DarkDiamond

    TL ;DR

    


    What did I do wrong in the following PowerShell-Script ? It does not work as expected.

    



    


    I am recording some of my lectures in my university with a photo camera. This works pretty well although I have to split the single lecture into three to four parts because the camera can only record 29 minutes of video in one take. I know that this is a common issue related to some licensensing problem that most photo cameras simply don't have the right license to record longer videos. But it confronts me with the problem that I later have to edit the files together after I did some post processing on them.

    


    With the camera I produce up to four video files with sizes around 3.5 GB which is way to big in order to be of any use because our IT department understandably doesn't want to host so much data, as I produce around 22 GB of video material each week.

    


    Some time ago I came across a very useful tool called "other-video-transcoding" by Don Melton over on GitHub, written in ruby, that allows me to compress the files to a reasonable file size without any visual loss. In addition I crop the videos to remove the part of each frame that is neither the board nor a place where my professor stands in order to decrease the filesize even further and do some privacy protection by cutting out most of the students.

    


    As the tools are accessable via the command line, it is relatively easy to configure and does not cost additional computational power to render a nice gui, so I can edit one of the 29 minute clips in less than 10 minutes.

    


    Now I wanted to optimize my workflow by writing a PowerShell script that only takes the parameters what to crop and which files to work on and then does the rest on its own so I can just start the script and then do something else while my laptop renders the new files.

    


    So far I have the following :

    


    $video_path = Get-ChildItem ..\ -Directory | findstr "SoSe"

Get-ChildItem $video_path -name | findstr ".MP4" | Out-File temp.txt -Append 
Get-Content temp.txt | ForEach-Object {"file " + $_} >> .\files.txt

Get-ChildItem $video_path |
Foreach-Object {
other-transcode --hevc --mp4 --target 3000 --crop 1920:780:0:0 $_.FullName
}

#other-transcode --hevc --mp4 --crop 1920:720:60:0 ..\SoSe22_Theo1_videos_v14_RAW\
ffmpeg -f concat -i files.txt -c copy merged.mp4
Remove-Item .\temp.txt


    


    but it does not quite do what I it expect to do.
This is my file system :

    


    sciebo/
└── SoSe22_Theo1_videos/
    ├── SoSe22_Theo1_videos_v16/
    │   ├── SoSe22_Theo1_videos_v16_KOMPR/
    │   │   ├── C0001.mp4
    │   │   ├── C0002.mp4
    │   │   ├── C0003.mp4
    │   │   ├── C0004.mp4
    │   │   ├── temp.txt
    │   │   ├── files.txt
    │   │   └── merged.mp4
    │   └── SoSe22_Theo1_videos_v16_RAW/
    │       ├── C0001.mp4
    │       ├── C0002.mp4
    │       ├── C0003.mp4
    │       └── C0004.mp4
    └── SoSe22_Theo1_videos_v17/
        ├── SoSe22_Theo1_videos_v17_KOMPR
        └── SoSe22_Theo1_videos_v17_RAW/
            ├── C0006.mp4
            ├── C0007.mp4
            ├── C0008.mp4
            └── C0009.mp4


    


    where the 16th lecture is already processed and the 17th is not. I always have the raw video data in the folders ending on RAW and the edited/compressed output files in the one ending on KOMPR. Note that the video files in the KOMPR folder are the output files of the other-transcode tool.

    


    The real work happens in the line where it says

    


    other-transcode --hevc --mp4 --target 3000 --crop 1920:780:0:0 $_.FullName


    


    and in the line

    


    ffmpeg -f concat -i files.txt -c copy merged.mp4


    


    where I concat the output files into the final version I can upload to our online learning platform.
What is wrong with my script ? In the end I'd like to pass the --crop parameter just to my script, but that is not the primary problem.

    



    


    A little information on the transcoding script so you don't have to look into the documentation :
    
As the last argument the tool takes the location of the video files to work on, be it relative or absolute file paths. The output is placed in the folder the script is called in, so if I cd into one of the KOMPR directories and then call

    


    other-transcode --mp4 ../SoSe22_Theo1_videos_v16_RAW/C0001.mp4


    


    a new file C0001.mp4 is created in the KOMPR directory and the transcoded video and old audio are written to that new video file.

    


  • Python Flask : Saving live stream video to a file periodically

    25 juillet 2023, par Sanjay Shahi

    I am creating a flask application with JavaScript to save the live video streams to a file.

    


    What I am trying to achieve here is that, the video stream will be sent to flask application periodically (20 secs). The first time it will create a video and after that, the video needs to be merged to the existing file.

    


    I am using SocketIO to transmit the video from JS.

    


    `async function startCapture() {
  try {
    // Access the user's webcam
    stream = await navigator.mediaDevices.getUserMedia({ 
      video: true,
      audio: { echoCancellation: true, noiseSuppression: true },
    });

    // Attach the stream to the video element
    video.srcObject = stream;

    // Create a new MediaRecorder instance to capture video chunks
    recorder = new MediaRecorder(stream);

    // Event handler for each data chunk received from the recorder
    recorder.ondataavailable = (e) => {
      const videoBlob = e.data;
      transmitVideoChunk(videoBlob);
      chunks.push(e.data);
    };

    // Start recording the video stream
    recorder.start();

    // Enable/disable buttons
    startButton.disabled = true;
    stopButton.disabled = false;

    // Start transmitting video chunks at the desired fps
    startTransmitting();
  } catch (error) {
    console.error('Error accessing webcam:', error);
  }
}`


    


    `
function transmitVideoBlob() {
    const videoBlob = new Blob(chunks, { type: 'video/webm' });
    socket.emit('video_data', videoBlob);
    // Clear the chunks array
    chunks = [];
}

// Start transmitting video chunks at the desired fps
function startTransmitting() {
    const videoInterval = 20000; // Interval between frames in milliseconds
    videoIntervalId = setInterval(() => {
        transmitVideoBlob();
    }, videoInterval);
}`


    


    In flask, I have created a function, which will call create_videos.
video_path : location to save the video
filename : file name of video
new_video_data_blob : binary data received from JS

    


    def create_videos(video_path, filename, new_video_data_blob):
    chunk_filename = os.path.join(video_path, f"{str(uuid1())}_{filename}")
    final_filename = os.path.join(video_path, filename)
    out_final_filename = os.path.join(video_path, "out_" + filename)
    # Save the current video chunk to a file
    with open(chunk_filename, "wb") as f:
        print("create file chunk ", chunk_filename)
        f.write(new_video_data_blob)

    if not os.path.exists(final_filename):
        # If the final video file doesn't exist, rename the current chunk file
        os.rename(chunk_filename, final_filename)
    else:
        while not os.path.exists(chunk_filename):
            time.sleep(0.1)
        # If the final video file exists, use FFmpeg to concatenate the current chunk with the existing file
        try:
            subprocess.run(
                [
                    "ffmpeg",
                    "-i",
                    f"concat:{final_filename}|{chunk_filename}",
                    "-c",
                    "copy",
                    "-y",
                    out_final_filename,
                ]
            )
            while not os.path.exists(out_final_filename):
                time.sleep(0.1)
            os.remove(final_filename)
            os.rename(out_final_filename, final_filename)

        except Exception as e:
            print(e)
        # Remove the current chunk file
        os.remove(chunk_filename)
    return final_filename


    


    When I record as well using below code in JS

    


    audio: { echoCancellation: true, noiseSuppression: true },


    


    I get the following error.

    


    [NULL @ 0x55e697e8c900] Invalid profile 5.
[webm @ 0x55e697ec3180] Non-monotonous DTS in output stream 0:0; previous: 37075, current: 37020; changing to 37075. This may result in incorrect timestamps in the output file.
[NULL @ 0x55e697e8d8c0] Error parsing Opus packet header.
    Last message repeated 1 times
[NULL @ 0x55e697e8c900] Invalid profile 5.
[NULL @ 0x55e697e8d8c0] Error parsing Opus packet header.


    


    enter image description here

    


    But when I record video only, it will work fine.

    


    How can I merge the new binary data to the existing video file ?