Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (40)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

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

Sur d’autres sites (7018)

  • NumPy array of a video changes from the original after writing into the same video

    29 mars 2021, par Rashiq

    I have a video (test.mkv) that I have converted into a 4D NumPy array - (frame, height, width, color_channel). I have even managed to convert that array back into the same video (test_2.mkv) without altering anything. However, after reading this new, test_2.mkv, back into a new NumPy array, the array of the first video is different from the second video's array i.e. their hashes don't match and the numpy.array_equal() function returns false. I have tried using both python-ffmpeg and scikit-video but cannot get the arrays to match.

    


    Python-ffmpeg attempt :

    


    import ffmpeg
import numpy as np
import hashlib

file_name = 'test.mkv'

# Get video dimensions and framerate
probe = ffmpeg.probe(file_name)
video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
width = int(video_stream['width'])
height = int(video_stream['height'])
frame_rate = video_stream['avg_frame_rate']

# Read video into buffer
out, error = (
    ffmpeg
        .input(file_name, threads=120)
        .output("pipe:", format='rawvideo', pix_fmt='rgb24')
        .run(capture_stdout=True)
)

# Convert video buffer to array
video = (
    np
        .frombuffer(out, np.uint8)
        .reshape([-1, height, width, 3])
)

# Convert array to buffer
video_buffer = (
    np.ndarray
        .flatten(video)
        .tobytes()
)

# Write buffer back into a video
process = (
    ffmpeg
        .input('pipe:', format='rawvideo', s='{}x{}'.format(width, height))
        .output("test_2.mkv", r=frame_rate)
        .overwrite_output()
        .run_async(pipe_stdin=True)
)
process.communicate(input=video_buffer)

# Read the newly written video
out_2, error = (
    ffmpeg
        .input("test_2.mkv", threads=40)
        .output("pipe:", format='rawvideo', pix_fmt='rgb24')
        .run(capture_stdout=True)
)

# Convert new video into array
video_2 = (
    np
        .frombuffer(out_2, np.uint8)
        .reshape([-1, height, width, 3])
)

# Video dimesions change
print(f'{video.shape} vs {video_2.shape}') # (844, 1080, 608, 3) vs (2025, 1080, 608, 3)
print(f'{np.array_equal(video, video_2)}') # False

# Hashes don't match
print(hashlib.sha256(bytes(video_2)).digest()) # b'\x88\x00\xc8\x0ed\x84!\x01\x9e\x08 \xd0U\x9a(\x02\x0b-\xeeA\xecU\xf7\xad0xa\x9e\\\xbck\xc3'
print(hashlib.sha256(bytes(video)).digest()) # b'\x9d\xc1\x07xh\x1b\x04I\xed\x906\xe57\xba\xf3\xf1k\x08\xfa\xf1\xfaM\x9a\xcf\xa9\t8\xf0\xc9\t\xa9\xb7'


    


    Scikit-video attempt :

    


    import skvideo.io as sk
import numpy as np

video_data = sk.vread('test.mkv')

sk.vwrite('test_2_ski.mkv', video_data)

video_data_2 = sk.vread('test_2_ski.mkv')

# Dimensions match but...
print(video_data.shape) # (844, 1080, 608, 3)
print(video_data_2.shape) # (844, 1080, 608, 3)

# ...array elements don't
print(np.array_equal(video_data, video_data_2)) # False

# Hashes don't match either
print(hashlib.sha256(bytes(video_2)).digest()) # b'\x8b?]\x8epD:\xd9B\x14\xc7\xba\xect\x15G\xfaRP\xde\xad&EC\x15\xc3\x07\n{a[\x80'
print(hashlib.sha256(bytes(video)).digest()) # b'\x9d\xc1\x07xh\x1b\x04I\xed\x906\xe57\xba\xf3\xf1k\x08\xfa\xf1\xfaM\x9a\xcf\xa9\t8\xf0\xc9\t\xa9\xb7'


    


    I don't understand where I'm going wrong and both the respective documentations do not highlight how to do this particular task. Any help is appreciated. Thank you.

    


  • FFMpeg with PHP-7.0 on Ubuntu

    25 octobre 2018, par Gabriel Bueno Lemes da Silva

    I have a NGINX server with PHP-7.0 and I would like to install the ffmpeg-php extension. I’ve been trying for a few days now and in many ways.

    The method that worked so far was compiling ffmpeg (https://ffmpeg.org/releases/ffmpeg-4.0.2.tar.bz2) manually, but when trying to compile ffmpeg-php (https: // sourceforge. net / projects / ffmpeg-php / files / ffmpeg-php / 0.6.0 / ffmpeg-php-0.6.0.tbz2 / download) I am encountering the following error message :

    root@zumbiserver-mercury : /php7-ffmpeg# make /bin/bash

    /root/php7-ffmpeg/libtool —mode=compile cc -I. -I/root/php7-ffmpeg
    -DPHP_ATOM_INC -I/root/php7-ffmpeg/include -I/root/php7-ffmpeg/main -I/root/php7-ffmpeg -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /root/php7-ffmpeg/ffmpeg-php.c -o ffmpeg-php.lo libtool : compile : cc
    -I. -I/root/php7-ffmpeg -DPHP_ATOM_INC -I/root/php7-ffmpeg/include -I/root/php7-ffmpeg/main -I/root/php7-ffmpeg -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /root/php7-ffmpeg/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o In
    file included from /usr/include/x86_64-linux-gnu/sys/stat.h:104:0,
    from /usr/include/php/20151012/Zend/zend_stream.h:28,
    from /usr/include/php/20151012/Zend/zend.h:41,
    from /usr/include/php/20151012/main/php.h:36,
    from /root/php7-ffmpeg/ffmpeg-php.c:40 : /usr/include/x86_64-linux-gnu/bits/stat.h:91:21 : error : field
    ‘st_atim’ has incomplete type
    struct timespec st_atim ; /* Time of last access. /
    ^ /usr/include/x86_64-linux-gnu/bits/stat.h:92:21 : error : field
    ‘st_mtim’ has incomplete type
    struct timespec st_mtim ; /
    Time of last modification. /
    ^ /usr/include/x86_64-linux-gnu/bits/stat.h:93:21 : error : field
    ‘st_ctim’ has incomplete type
    struct timespec st_ctim ; /
    Time of last status change. /
    ^ /usr/include/x86_64-linux-gnu/bits/stat.h:152:21 : error : field
    ‘st_atim’ has incomplete type
    struct timespec st_atim ; /
    Time of last access. /
    ^ /usr/include/x86_64-linux-gnu/bits/stat.h:153:21 : error : field
    ‘st_mtim’ has incomplete type
    struct timespec st_mtim ; /
    Time of last modification. /
    ^ /usr/include/x86_64-linux-gnu/bits/stat.h:154:21 : error : field
    ‘st_ctim’ has incomplete type
    struct timespec st_ctim ; /
    Time of last status change. /
    ^ In file included from /usr/include/php/20151012/Zend/zend_stream.h:28:0,
    from /usr/include/php/20151012/Zend/zend.h:41,
    from /usr/include/php/20151012/main/php.h:36,
    from /root/php7-ffmpeg/ffmpeg-php.c:40 : /usr/include/x86_64-linux-gnu/sys/stat.h:364:31 : error : array type has
    incomplete element type ‘struct timespec’
    const struct timespec __times[2],
    ^ /usr/include/x86_64-linux-gnu/sys/stat.h:371:54 : error : array type has
    incomplete element type ‘struct timespec’ extern int futimens (int
    __fd, const struct timespec __times[2]) __THROW ;
    ^ In file included from /usr/include/php/20151012/main/php.h:395:0,
    from /root/php7-ffmpeg/ffmpeg-php.c:40 : /usr/include/php/20151012/Zend/zend_virtual_cwd.h:218:2 : error :
    unknown type name ‘time_t’ time_t expires ;
    ^ /usr/include/php/20151012/Zend/zend_virtual_cwd.h:248:86 : error :
    unknown type name ‘time_t’ CWD_API realpath_cache_bucket

    realpath_cache_lookup(const char *path, int path_len, time_t t) ;
    ^ /root/php7-ffmpeg/ffmpeg-php.c : In function ‘zm_startup_ffmpeg’ :
    /root/php7-ffmpeg/ffmpeg-php.c:108:5 : warning : implicit declaration of
    function ‘avcodec_init’ [-Wimplicit-function-declaration]
    avcodec_init() ;
    ^ /root/php7-ffmpeg/ffmpeg-php.c:111:5 : warning : ‘av_register_all’ is deprecated [-Wdeprecated-declarations]
    av_register_all() ;
    ^ In file included from /root/php7-ffmpeg/ffmpeg-php.c:43:0 : /usr/local/include/libavformat/avformat.h:2025:6 : note : declared here
    void av_register_all(void) ;

     ^ Makefile:194: recipe for target 'ffmpeg-php.lo' failed make: *** [ffmpeg-php.lo] Error 1

    Can someone give me a light ? I do not know what else to do !

  • ffmpeg pipe process ends right after writing first buffer data to input stream and does not keep running

    6 mai, par Taketo Matsunaga

    I have been trying to convert 16bit PCM (s16le) audio data to webm using ffmpeg in C#.
But the process ends right after the writing the first buffer data to standard input.
I has exited with the status 0, meaning success. But do not know why....
Could anyone tell me why ?

    


    I apprecite it if you could support me.

    


        public class SpeechService : ISpeechService&#xA;    {&#xA;        &#xA;        /// <summary>&#xA;        /// Defines the _audioInputStream&#xA;        /// </summary>&#xA;        private readonly MemoryStream _audioInputStream = new MemoryStream();&#xA;&#xA;        public async Task SendPcmAsWebmViaWebSocketAsync(&#xA;            MemoryStream pcmAudioStream,&#xA;            int sampleRate,&#xA;            int channels) &#xA;        {&#xA;            string inputFormat = "s16le";&#xA;&#xA;            var ffmpegProcessInfo = new ProcessStartInfo&#xA;            {&#xA;                FileName = _ffmpegPath,&#xA;                Arguments =&#xA;                    $"-f {inputFormat} -ar {sampleRate} -ac {channels} -i pipe:0 " &#x2B;&#xA;                    $"-f webm pipe:1",&#xA;                RedirectStandardInput = true,&#xA;                RedirectStandardOutput = true,&#xA;                RedirectStandardError = true,&#xA;                UseShellExecute = false,&#xA;                CreateNoWindow = true,&#xA;            };&#xA;&#xA;            _ffmpegProcess = new Process { StartInfo = ffmpegProcessInfo };&#xA;&#xA;            Console.WriteLine("Starting FFmpeg process...");&#xA;            try&#xA;            {&#xA;&#xA;                if (!await Task.Run(() => _ffmpegProcess.Start()))&#xA;                {&#xA;                    Console.Error.WriteLine("Failed to start FFmpeg process.");&#xA;                    return;&#xA;                }&#xA;                Console.WriteLine("FFmpeg process started.");&#xA;&#xA;            }&#xA;            catch (Exception ex)&#xA;            {&#xA;                Console.Error.WriteLine($"Error starting FFmpeg process: {ex.Message}");&#xA;                throw;&#xA;            }&#xA;&#xA;            var encodeAndSendTask = Task.Run(async () =>&#xA;            {&#xA;                try&#xA;                {&#xA;                    using var ffmpegOutputStream = _ffmpegProcess.StandardOutput.BaseStream;&#xA;                    byte[] buffer = new byte[8192]; // Temporary buffer to read data&#xA;                    byte[] sendBuffer = new byte[8192]; // Buffer to accumulate data for sending&#xA;                    int sendBufferIndex = 0; // Tracks the current size of sendBuffer&#xA;                    int bytesRead;&#xA;&#xA;                    Console.WriteLine("Reading WebM output from FFmpeg and sending via WebSocket...");&#xA;                    while (true)&#xA;                    {&#xA;                        if ((bytesRead = await ffmpegOutputStream.ReadAsync(buffer, 0, buffer.Length)) > 0)&#xA;                        {&#xA;                            // Copy data to sendBuffer&#xA;                            Array.Copy(buffer, 0, sendBuffer, sendBufferIndex, bytesRead);&#xA;                            sendBufferIndex &#x2B;= bytesRead;&#xA;&#xA;                            // If sendBuffer is full, send it via WebSocket&#xA;                            if (sendBufferIndex >= sendBuffer.Length)&#xA;                            {&#xA;                                var segment = new ArraySegment<byte>(sendBuffer, 0, sendBuffer.Length);&#xA;                                _ws.SendMessage(segment);&#xA;                                sendBufferIndex = 0; // Reset the index after sending&#xA;                            }&#xA;                        }&#xA;                    }&#xA;                }&#xA;                catch (OperationCanceledException)&#xA;                {&#xA;                    Console.WriteLine("Encode/Send operation cancelled.");&#xA;                }&#xA;                catch (IOException ex) when (ex.InnerException is ObjectDisposedException)&#xA;                {&#xA;                    Console.WriteLine("Stream was closed, likely due to process exit or cancellation.");&#xA;                }&#xA;                catch (Exception ex)&#xA;                {&#xA;                    Console.Error.WriteLine($"Error during encoding/sending: {ex}");&#xA;                }&#xA;            });&#xA;&#xA;            var errorReadTask = Task.Run(async () =>&#xA;            {&#xA;                Console.WriteLine("Starting to read FFmpeg stderr...");&#xA;                using var errorReader = _ffmpegProcess.StandardError;&#xA;                try&#xA;                {&#xA;                    string? line;&#xA;                    while ((line = await errorReader.ReadLineAsync()) != null) &#xA;                    {&#xA;                        Console.WriteLine($"[FFmpeg stderr] {line}");&#xA;                    }&#xA;                }&#xA;                catch (OperationCanceledException) { Console.WriteLine("FFmpeg stderr reading cancelled."); }&#xA;                catch (TimeoutException) { Console.WriteLine("FFmpeg stderr reading timed out (due to cancellation)."); }&#xA;                catch (Exception ex) { Console.Error.WriteLine($"Error reading FFmpeg stderr: {ex.Message}"); }&#xA;                Console.WriteLine("Finished reading FFmpeg stderr.");&#xA;            });&#xA;&#xA;        }&#xA;&#xA;        public async Task AppendAudioBuffer(AudioMediaBuffer audioBuffer)&#xA;        {&#xA;            try&#xA;            {&#xA;                // audio for a 1:1 call&#xA;                var bufferLength = audioBuffer.Length;&#xA;                if (bufferLength > 0)&#xA;                {&#xA;                    var buffer = new byte[bufferLength];&#xA;                    Marshal.Copy(audioBuffer.Data, buffer, 0, (int)bufferLength);&#xA;&#xA;                    _logger.Info("_ffmpegProcess.HasExited:" &#x2B; _ffmpegProcess.HasExited);&#xA;                    using var ffmpegInputStream = _ffmpegProcess.StandardInput.BaseStream;&#xA;                    await ffmpegInputStream.WriteAsync(buffer, 0, buffer.Length);&#xA;                    await ffmpegInputStream.FlushAsync(); // バッファをフラッシュ&#xA;                    _logger.Info("Wrote buffer data.");&#xA;&#xA;                }&#xA;            }&#xA;            catch (Exception e)&#xA;            {&#xA;                _logger.Error(e, "Exception happend writing to input stream");&#xA;            }&#xA;        }&#xA;&#xA;</byte>

    &#xA;

    Starting FFmpeg process...&#xA;FFmpeg process started.&#xA;Starting to read FFmpeg stderr...&#xA;Reading WebM output from FFmpeg and sending via WebSocket...&#xA;[FFmpeg stderr] ffmpeg version 7.1.1-essentials_build-www.gyan.dev Copyright (c) 2000-2025 the FFmpeg developers&#xA;[FFmpeg stderr]   built with gcc 14.2.0 (Rev1, Built by MSYS2 project)&#xA;[FFmpeg stderr]   configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband&#xA;[FFmpeg stderr]   libavutil      59. 39.100 / 59. 39.100&#xA;[FFmpeg stderr]   libavcodec     61. 19.101 / 61. 19.101&#xA;[FFmpeg stderr]   libavformat    61.  7.100 / 61.  7.100&#xA;[FFmpeg stderr]   libavdevice    61.  3.100 / 61.  3.100&#xA;[FFmpeg stderr]   libavfilter    10.  4.100 / 10.  4.100&#xA;[FFmpeg stderr]   libswscale      8.  3.100 /  8.  3.100&#xA;[FFmpeg stderr]   libswresample   5.  3.100 /  5.  3.100&#xA;[FFmpeg stderr]   libpostproc    58.  3.100 / 58.  3.100&#xA;&#xA;[2025-05-06 15:44:43,598][INFO][XbLogger.cs:85] _ffmpegProcess.HasExited:False&#xA;[2025-05-06 15:44:43,613][INFO][XbLogger.cs:85] Wrote buffer data.&#xA;[2025-05-06 15:44:43,613][INFO][XbLogger.cs:85] Wrote buffer data.&#xA;[FFmpeg stderr] [aist#0:0/pcm_s16le @ 0000025ec8d36040] Guessed Channel Layout: mono&#xA;[FFmpeg stderr] Input #0, s16le, from &#x27;pipe:0&#x27;:&#xA;[FFmpeg stderr]   Duration: N/A, bitrate: 256 kb/s&#xA;[FFmpeg stderr]   Stream #0:0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s&#xA;[FFmpeg stderr] Stream mapping:&#xA;[FFmpeg stderr]   Stream #0:0 -> #0:0 (pcm_s16le (native) -> opus (libopus))&#xA;[FFmpeg stderr] [libopus @ 0000025ec8d317c0] No bit rate set. Defaulting to 64000 bps.&#xA;[FFmpeg stderr] Output #0, webm, to &#x27;pipe:1&#x27;:&#xA;[FFmpeg stderr]   Metadata:&#xA;[FFmpeg stderr]     encoder         : Lavf61.7.100&#xA;[FFmpeg stderr]   Stream #0:0: Audio: opus, 16000 Hz, mono, s16, 64 kb/s&#xA;[FFmpeg stderr]       Metadata:&#xA;[FFmpeg stderr]         encoder         : Lavc61.19.101 libopus&#xA;[FFmpeg stderr] [out#0/webm @ 0000025ec8d36200] video:0KiB audio:1KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 67.493113%&#xA;[FFmpeg stderr] size=       1KiB time=00:00:00.04 bitrate= 243.2kbits/s speed=2.81x&#xA;Finished reading FFmpeg stderr.&#xA;[2025-05-06 15:44:44,101][INFO][XbLogger.cs:85] _ffmpegProcess.HasExited:True&#xA;[2025-05-06 15:44:44,132][ERROR][XbLogger.cs:67] Exception happend writing to input stream&#xA;System.ObjectDisposedException: Cannot access a closed file.&#xA;   at System.IO.FileStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)&#xA;   at System.IO.Stream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count)&#xA;   at EchoBot.Media.SpeechService.AppendAudioBuffer(AudioMediaBuffer audioBuffer) in C:\Users\tm068\Documents\workspace\myprj\xbridge-teams-bot\src\EchoBot\Media\SpeechService.cs:line 242&#xA;

    &#xA;

    I am expecting the ffmpeg process keep running.

    &#xA;