Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (26)

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

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

Sur d’autres sites (7475)

  • ffmpeg output to stdout is a black box (python)

    27 juillet 2022, par dwilliams

    Project Background :
The project I'm working on takes an image from a UE simulation camera, uses OpenCV to convert the image to .jpg, and streams the .jpg to a localhost port so that a second program can retrieve the images and annotate the objects in the simulation. I am attempting to convert these to a suitable format for UE4's WmfMediaPlayer via ffmpeg so that it can be streamed to another localhost port.

    


    Problem :
I have managed to get a the stream active but the video at the end of stream is a black square. I'm confident but not 100% certain that I've setup the ffmpeg correctly. The output to console seem to imply that the conversion is working but I've been fooled before. It could also be the flask yield component.

    


    ffmpeg declaration/setup :

    


    process = (
        ffmpeg
        .input('C:/MOT/test.jpg')   
        .output('pipe:1', vcodec='libx264', format='avi')   
        .overwrite_output()
        .run_async(pipe_stdin=True, pipe_stdout=True)
    )


    


    Flask Integration :

    


    @app.route('/annotated')
def annotated():
    return Response(
        frame_generator_annotated(),
        mimetype='multipart/x-mixed-replace; boundary=frame'
    )


def frame_generator_annotated():
    global process
    while (True):
        frame = process.stdout.read()
        yield (b'--frame\r\n'
               b'Content-Type: video/avi\r\n\r\n' + frame + b'\r\n\r\n')


    


    stream view :
http://localhost:5001/annotated

    


    ffmpeg console output :

    


    Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://192.168.1.220:5001/ (Press CTRL+C to quit)
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.2.1 (GCC) 20200726
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[mjpeg @ 00000269be0faec0] EOI missing, emulating
Input #0, image2, from 'C:/MOT/test.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 1968 kb/s
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1024x576 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 00000269be0fc240] using SAR=1/1
[libx264 @ 00000269be0fc240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 00000269be0fc240] profile High, level 3.1, 4:2:0, 8-bit
Output #0, avi, to 'pipe:1':
  Metadata:
    ISFT            : Lavf58.45.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuvj420p(pc), 1024x576 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=28.0 Lsize=       2kB time=00:00:00.04 bitrate= 447.2kbits/s speed= 2.9x    
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 157.307251%
[libx264 @ 00000269be0fc240] frame I:1     Avg QP:13.00  size:   869
[libx264 @ 00000269be0fc240] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 00000269be0fc240] 8x8 transform intra:0.0%
[libx264 @ 00000269be0fc240] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0%
[libx264 @ 00000269be0fc240] i16 v,h,dc,p: 97%  0%  3%  0%
[libx264 @ 00000269be0fc240] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 00000269be0fc240] kb/s:173.80


    


  • ffmpeg - convert background to black ? [closed]

    22 juin 2022, par david furst

    the basic problem
    
convert all pixels in all frames of a source video to black if they have a white value below a certain threshold and output the results as a series of static images with no transparency.

    


    my solution so far
    
i am able to do this with a two-step process :

    


      

    1. convert pixels below the threshold to transparent using ffmpeg's colorkey filtre, outputting a series as PNG.
    2. 


    3. use imagemagick to convert the PNG to JPEG.
    4. 


    


    this approach is very slow. ideally i'd like to do everything in one go, within ffmpeg.

    


    the reason i haven't been able to do that so far is that the resulting transparency isn't discarded (as i'd hoped) when outputting to non-transparent formats like JPG, even if i try to 'discard' the alpha layer beforehand using combinations of split and lutrgb ; the resulting JPEGs still resemble the original images.

    


    my current filter chain :

    


    ffmpeg -hide_banner -y -i input.mp4 -f lavfi -i color=c=white \
    -filter_complex "[0:v]format=gray[src];
        [1][src]scale2ref[white][vid];
        [vid][white]blend=all_mode=multiply:shortest=1,colorkey=black:0.95" %05d.png


    


  • FFmpeg extracts black image from H264 stream

    8 juin 2022, par massivemoisture

    I have a C# application that receives H264 stream through a socket. I want to continuously get the latest image from that stream.

    


    Here's what I did with FFmpeg 5.0.1, just a rough sample to get ONE latest image, how I start FFmpeg :

    


    var ffmpegInfo = new ProcessStartInfo(FFMPEG_PATH);
ffmpegInfo.RedirectStandardInput = true;
ffmpegInfo.RedirectStandardOutput = true;
ffmpegInfo.RedirectStandardError = true;
ffmpegInfo.UseShellExecute = false;

ffmpegInfo.Arguments = "-i pipe: -f h264 -pix_fmt bgr24 -an -sn pipe:";

ffmpegInfo.UseShellExecute = false;
ffmpegInfo.CreateNoWindow = true;

Process myFFmpeg = new Process();
myFFmpeg.StartInfo = ffmpegInfo;
myFFmpeg.EnableRaisingEvents = true;
myFFmpeg.Start();

var inStream = myFFmpeg.StandardInput.BaseStream;
FileStream baseStream = myFFmpeg.StandardOutput.BaseStream as FileStream;
myFFmpeg.BeginErrorReadLine();


    


    Then I start a new thread to receive the stream through socket :

    


    // inStream is "myFFmpeg.StandardInput.BaseStream" from the code block above
var t = Task.Run(() => ReceiveStream(inStream));


    


    Next I read the output from FFmpeg :

    


    byte[] decoded = new byte[Width * Height * 3];
int numBytesToRead = Width * Height * 3;
int numBytesRead = 0;

while (numBytesToRead > 0)
{
   int n = baseStream.Read(decoded, 0, decoded.Length);
   Console.WriteLine($"Read {n} bytes");
   if (n == 0)
   {
      break;
   }              
      numBytesRead += n;
      numBytesToRead -= n;
}


    


    Lastly, I use ImageSharp library to save decoded byte array as a jpeg file.

    


    image.Save("test.jpeg", encoder);


    


    However, test.jpeg always comes out as a black image. What did I do wrong ?
Here's the stderr log that I got from ffmpeg :

    


    
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m/bt470bg/smpte170m, progressive), 1080x2256, 25 fps, 25 tbr, 1200k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Incompatible pixel format 'bgr24' for codec 'libx264', auto-selecting format 'yuv444p'
[libx264 @ 0x11b9068f0] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x11b9068f0] profile High 4:4:4 Predictive, level 5.0, 4:4:4, 8-bit
Output #0, h264, to 'pipe:':
  Metadata:
    encoder         : Lavf59.16.100
  Stream #0:0: Video: h264, yuv444p(tv, smpte170m/bt470bg/smpte170m, progressive), 1080x2256, q=2-31, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc59.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=   56 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
frame=   87 fps= 83 q=28.0 size=     370kB time=00:00:01.16 bitrate=2610.6kbits/s speed=1.11x
frame=  118 fps= 75 q=28.0 size=     698kB time=00:00:02.40 bitrate=2381.4kbits/s speed=1.54x
frame=  154 fps= 75 q=28.0 size=    1083kB time=00:00:03.84 bitrate=2311.1kbits/s speed=1.86x
...


    


    Thank you !

    


    Edit : as suggested by @kesh, I have changed h264 to rawvideo, the arguments now are : -i pipe: -f rawvideo -pix_fmt bgr24 -an -sn pipe:

    


    Here's the output of ffmpeg :

    


    Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuv420p(tv, smpte170m/bt470bg/smpte170m, progressive), 1080x2256, 25 fps, 25 tbr, 1200k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
// About 9 of these "No accelerated colorspace..." message
[swscaler @ 0x128690000] [swscaler @ 0x1286a0000] No accelerated colorspace conversion found from yuv420p to bgr24.
Output #0, rawvideo, to 'pipe:':
  Metadata:
    encoder         : Lavf59.16.100
  Stream #0:0: Video: rawvideo (BGR[24] / 0x18524742), bgr24(pc, gbr/bt470bg/smpte170m, progressive), 1080x2256, q=2-31, 1461888 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc59.18.100 rawvideo
frame=    1 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
// FFmpeg outputs no more log after this