Recherche avancée

Médias (0)

Mot : - Tags -/flash

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (101)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (16547)

  • How to start an FFmpeg process, create a pipe and write data from the parent process ?

    3 mai 2021, par xlxs

    My code is based on https://stackoverflow.com/a/32279430/5941827.

    


    I run FFmpeg with the following params :

    


    std::stringstream sstm;
sstm << "ffmpeg -loglevel error -y -f rawvideo -vcodec rawvideo -s " << std::to_string(width) << "x" << std::to_string(height) //
        << " -pix_fmt rgb24 -framerate " << std::to_string(fps) << " -i - -c:v libx264 -preset " << getPreset(encodeSpeed) << //
        " -crf " << std::to_string(crf) << " -shortest " << path;


    


    (the variables are initialized in a class constructor correctly)

    


    Then I open the pipe with pPipe = popen(sstm.str().c_str(), "w").The problem is after I fwrite to it and calling fclose, based on the contents I write sometimes less or more bytes reach FFmpeg, and I get

    


    [rawvideo @ 000000000010c3df] Invalid buffer size, packet size 196606 < expected frame_size 196608
Error while decoding stream #0:0: Invalid argument


    


    The saved output video usually has one frame more or less than the expected.
I have checked the array I'm sending trough the pipe with fwrite and it's size is correct.
It appears that based on the data I send some bytes don't get there, or more bytes than I send go through the pipe.

    


    I have also tried two different FFmpeg versions, but with the same error message.

    


  • Pipe video frames from ffmpeg to numpy array without loading whole movie into memory

    2 mai 2021, par marcman

    I'm not sure whether what I'm asking is feasible or functional, but I'm experimenting with trying to load frames from a video in an ordered, but "on-demand," fashion.

    


    Basically what I have now is to read the entire uncompressed video into a buffer by piping through stdout, e.g. :

    


    H, W = 1080, 1920 # video dimensions
video = '/path/to/video.mp4' # path to video

# ffmpeg command
command = [ "ffmpeg",
            '-i', video,
            '-pix_fmt', 'rgb24',
            '-f', 'rawvideo',
            'pipe:1' ]

# run ffmpeg and load all frames into numpy array (num_frames, H, W, 3)
pipe = subprocess.run(command, stdout=subprocess.PIPE, bufsize=10**8)
video = np.frombuffer(pipe.stdout, dtype=np.uint8).reshape(-1, H, W, 3)

# or alternatively load individual frames in a loop
nb_img = H*W*3 # H * W * 3 channels * 1-byte/channel
for i in range(0, len(pipe.stdout), nb_img):
    img = np.frombuffer(pipe.stdout, dtype=np.uint8, count=nb_img, offset=i).reshape(H, W, 3)


    


    I'm wondering if it's possible to do this same process, in Python, but without first loading the entire video into memory. In my mind, I'm picturing something like :

    


      

    1. open the a buffer
    2. 


    3. seeking to memory locations on demand
    4. 


    5. loading frames to numpy arrays
    6. 


    


    I know there are other libraries, like OpenCV for example, that enable this same sort of behavior, but I'm wondering :

    


      

    • Is it possible to do this operation efficiently using this sort of ffmpeg-pipe-to-numpy-array operation ?
    • 


    • Does this defeat the speed-up benefit of ffmpeg directly rather than seeking/loading through OpenCV or first extracting frames and then loading individual files ?
    • 


    


  • How to pipe multiple inputs to ffmpeg through python subprocess ?

    14 avril 2021, par D. Ramsook

    I have a ffmpeg command that uses two different input files (stored in 'input_string'). In ffmpeg '-' after the '-i' represents reading from stdin.

    


    I currently use the below setup to collect the output of the command. How can it be modified so that fileA and fileB, which are stored as bytes, are piped as the inputs to the ffmpeg command ?

    


    from subprocess import run, PIPE

with open('fileA.yuv', 'rb') as f:
    fileA = f.read()

with open('fileB.yuv', 'rb') as f:
    fileB = f.read()   


input_string = """ffmpeg -f rawvideo -s:v 1280x720 -pix_fmt yuv420p -r 24 -i - -f rawvideo -s:v 50x50 -pix_fmt yuv420p -r 24 -i - -lavfi  ...#remainder of command"""
result = run(input_string, stdout=PIPE, stderr=PIPE, universal_newlines=True)
result = result.stderr.splitlines()