Recherche avancée

Médias (0)

Mot : - Tags -/protocoles

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

Autres articles (59)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (4474)

  • 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()


    


  • 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 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.