Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (27)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • 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" ;

  • D’autres logiciels intéressants

    12 avril 2011, par

    On ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
    La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
    On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
    Videopress
    Site Internet : (...)

Sur d’autres sites (5742)

  • JavaCV : avformat_open_input() hangs (not network, but with custom AVIOContext)

    14 octobre 2015, par Yun Tao Hai

    I’m using a custom AVIOContext to bridge FFMpeg with java IO. The function avformat_open_input() never returns. I have searched the web for similar problems, all of which were caused by faulty network or wrong server configurations. However, I’m not using network at all, as you can see in the following little program :

    package com.example;

    import org.bytedeco.javacpp.*;
    import java.io.File;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import static org.bytedeco.javacpp.avcodec.*;
    import static org.bytedeco.javacpp.avformat.*;
    import static org.bytedeco.javacpp.avutil.*;
    import static org.bytedeco.javacpp.avdevice.*;
    import static org.bytedeco.javacpp.avformat.AVFormatContext.*;

    public class Test {

       public static void main(String[] args) throws Exception {
           File dir = new File(System.getProperty("user.home"), "Desktop");
           File file = new File(dir, "sample.3gp");
           final RandomAccessFile raf = new RandomAccessFile(file, "r");

           Loader.load(avcodec.class);
           Loader.load(avformat.class);
           Loader.load(avutil.class);
           Loader.load(avdevice.class);
           Loader.load(swscale.class);
           Loader.load(swresample.class);

           avcodec_register_all();
           av_register_all();
           avformat_network_init();
           avdevice_register_all();

           Read_packet_Pointer_BytePointer_int reader = new Read_packet_Pointer_BytePointer_int() {
               @Override
               public int call(Pointer pointer, BytePointer buf, int bufSize) {
                   try {
                       byte[] data = new byte[bufSize]; // this is inefficient, just use as a quick example
                       int read = raf.read(data);

                       if (read <= 0) {
                           System.out.println("EOF found.");
                           return AVERROR_EOF;
                       }

                       System.out.println("Successfully read " + read + " bytes of data.");
                       buf.position(0);
                       buf.put(data, 0, read);
                       return read;
                   } catch (Exception ex) {
                       ex.printStackTrace();
                       return -1;
                   }
               }
           };

           Seek_Pointer_long_int seeker = new Seek_Pointer_long_int() {
               @Override
               public long call(Pointer pointer, long offset, int whence) {
                   try {
                       raf.seek(offset);
                       System.out.println("Successfully seeked to position " + offset + ".");
                       return offset;
                   } catch (IOException ex) {
                       return -1;
                   }
               }
           };

           int inputBufferSize = 32768;
           BytePointer inputBuffer = new BytePointer(av_malloc(inputBufferSize));
           AVIOContext ioContext = avio_alloc_context(inputBuffer, inputBufferSize, 1, null, reader, null, seeker);
           AVInputFormat format = av_find_input_format("3gp");
           AVFormatContext formatContext = avformat_alloc_context();
           formatContext.iformat(format);
           formatContext.flags(formatContext.flags() | AVFMT_FLAG_CUSTOM_IO);
           formatContext.pb(ioContext);

           // This never returns. And I can never get result.
           int result = avformat_open_input(formatContext, "", format, null);

           // all clean-up code omitted for simplicity
       }

    }

    And below is my sample console output :

    Successfully read 32768 bytes of data.
    Successfully read 32768 bytes of data.
    Successfully read 32768 bytes of data.
    Successfully read 32768 bytes of data.
    Successfully read 32768 bytes of data.
    Successfully read 7240 bytes of data.
    EOF found.

    I’ve checked the sum of bytes, which corresponds to the file size ; EOF is also hit, meaning the file is completely read. Actually I am a bit skeptical as why avformat_open_input() would even read the entire file and still without returning ? There must be something wrong with what I am doing. Can any expert shed some lights or point me to the right direction ? I’m new to javacv and ffmpeg and especially to programming with Buffers and stuff. Any help, suggestion or criticism is welcome. Thanks in advance.

  • Processing a single frame of audio and image in FFmpeg

    21 juillet 2015, par James F

    Currently we have an implementation of FFmpeg which is triggered from an ActionScript 3 (AS3) application, via CrossBridge (formerly Flascc). In this implementation, we write the entire audio track into the CModule’s memory, using malloc from the AS3 application. Once written, the application starts to process each of the image frames we would like to combine with our audio. This process begins by the AS3 application calling the CModule’s write_frame public method.

    C :
    int write_frame(struct Session *s, uint8_t *buffer, int bufferSize){}

    AS3 :
    var ret:int = writeFrame(_sessionPtr, _pixelBytesPtr, _pixelBytes.length);

    Once the video output has been created, it is retrieved from the CModule to AS3 as a byte array.

    With this implementation, a long duration video or audio track - the application runs out of memory (there’s a memory limit within our CrossBridge sandbox environment). The largest portion of this memory is currently our audio track, as it’s uncompressed PCM data (raw float values).

    Ideally, we would like to write a single audio frame and video frame together, with the AS3 application writing the 1 x audio frame byte array to the CModule’s memory. I have attempted to do this, by allocating the memory requirement for a single frame of audio using malloc, and then overwriting this memory, each time write_frame is called. However, this results in the video file containing a single frame of audio at the start of the video, and no other audio.

    I’m convinced that the audio frame is being constructed correctly, but I believe this approach is conflicting with some of the code within our Muxing.c file. It’s a little different to FFmpeg’s example file (https://ffmpeg.org/doxygen/trunk/muxing_8c-source.html), as this file has been modified by several people. Here’s the methods calls from within write_frame :

    fill_audio_buffer(s->audio_input, s->audio_input_length, s->audio_input_index, s->audio_input_frame_size * 2, s->audio_frame_buffer);

    retval = av_samples_alloc(converted_buffer, NULL, 2, out_samples, audio_st->codec->sample_fmt, 0);

    out_samples = swr_convert(s->audio_swr_context, converted_buffer, out_samples (void *) &s->audio_frame_buffer, in_samples);

    retval = write_audio_frame(s, s->oc, s->audio_st, s->audio_input_frame_size (uint16_t *) converted_buffer[0]);

    s->audio_input_index += s->audio_input_frame_size * 2;

    Is it possible to move to procedural muxing of 1 x frame of audio and 1 x frame of image approach ? Even if it’s slightly slower - it’ll mean we’re not hold the entire audio track in memory. Any suggestions to the required approach would be great, thanks in advance !

    @VC. One - The PCM data is made outside of FFmpeg and then written to the memory that FFmpeg has access to. (using malloc, and then the pointer to this address is sent to the FFmpeg).

    The FFmpeg output file can either be a .WMV file, or .AVi file - the codecs WMV2 and DIVX are used in each case. I have made some modifications since posting the original question, but you’re correct in thinking that the first chunk was being used and then the last frame size increased, meaning the next read of the buffer would yield nothing as it exceeded the buffer.

    I’ve now made some progress by resetting the index audio_input_index back to ’0’ at the start of each write_frame call. However, i’ll need to check whether this is the correct approach, as between each audio frame (1 second at 1fps), there is a slight blip/audio pop noise. In addition to this - the last few frames of audio seem to overlap, causing some of the audio to be repeated. Is it safe practice with C/FFmpeg to recycle a buffer in this way ? It seems that the length of each audio frame changes - at AS3 level my current calculation of the audio frame byte length is (44,100 kHz sample rate * 8) / Frames per second. It’s * 8 as it’s two channel, and each float value is 4 bytes.

    Thanks again for your help

  • Merge video with ffmpeg(or alternatives) with extra properties(an overlay)

    28 juin 2021, par dconixDev

    I'll be scraping clips from twitch and merging them to create a single video file.
I already figured out the scraping of twitch clip links(but i only get 16-20 videos because i need to scroll with selenium but i dont really mind it, if you have a working solution then make an answer about it) and also the simple merging videos.

    


    I'm scraping links with :

    


    #!/usr/bin/python3.9
import bs4
import requests
import time
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.firefox.options import Options

# Initialize driver and run it headless
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)

def extract_source(url):
     agent = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0"}
     source=requests.get(url, headers=agent).text
     return source

def extract_data(source):
     soup=bs4.BeautifulSoup(source, 'html.parser')
     names=soup.find_all('a', attrs={'data-a-target':'preview-card-image-link'})
     return names

driver.get('https://www.twitch.tv/directory/game/League%20of%20Legends/clips?range=24hr')

# I wait 3 seconds for the clips to get pulled in
# I'd like here to scroll down a bit so i can scrape more clips, but even after i tried some solutions my firefox(was debugging in GUI mode, not headless as it is now) wasnt scrolling
time.sleep(3)
extract_links=extract_data(driver.page_source)
for a in extract_links:
    print(a.get('href'))

driver.quit()

# I tried scrolling using this but didnt work, not sure why
# this script is supposed to scroll until youre at the end of the page
# SCROLL_PAUSE_TIME = 0.5

# # Get scroll height
# last_height = driver.execute_script("return document.body.scrollHeight")

# for i in range(3):
    # # Scroll down to bottom
    # driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

    # # Wait to load page
    # time.sleep(SCROLL_PAUSE_TIME)

    # # Calculate new scroll height and compare with last scroll height
    # new_height = driver.execute_script("return document.body.scrollHeight")
    # if new_height == last_height:
        # break
    # last_height = new_height


    


    I'm joining videos together after downloading(with youtube-dl) with ffmpeg :

    


    ffmpeg -safe 0 -f concat -segment_time_metadata 1 -i videos.txt -vf select=concatdec_select -af aselect=concatdec_select,aresample=async=1 out.mp4

    


    Where videos.txt is as follows :

    


    file 'video_file1.mp4'
file 'video_file2.mp4'
...


    


    I can't really find answers on how to add a watermark(different for each video, although i found this it doesnt explain how to add a unique watermark to individual videos but the same watermark to two videos) without having to render each and every video twice but doing so in one go.

    


    I think I stumbled upon some people who made their videos.txt as follows in purpose of adding extra options to each video :

    


    file 'video_file1.mp4'
option 1(for video_file1.mp4)
option 2(for video_file1.mp4)
file 'video_file2.mp4'
option 1(for video_file2.mp4)
option 2(for video_file2.mp4)
...


    


    Would this work for unique watermarks for each videos(lets suppose watermarks are named video_file1.png, ... meaning the same as the videos, also the watermark is transparent in case that needs more configuration)