Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (68)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (6024)

  • Can't set seeker in GSTREAMER cv2, python

    29 avril, par Alperen Ölçer

    I want to skip n seconds forward and backward in gstreamer cv2 capture for recorded videos. But when I use cap_gstreamer.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second) it resets seeker to beginning of video. How can I solve it ? I wrote an example, used recorded clock video.

    


    import cv2

video_p = '/home/alperenlcr/Videos/clock.mp4'

cap_gstreamer = cv2.VideoCapture(video_p, cv2.CAP_GSTREAMER)
cap_ffmpeg = cv2.VideoCapture(video_p, cv2.CAP_FFMPEG)

fps = cap_gstreamer.get(cv2.CAP_PROP_FPS)
skip_second = 100

im1 = cv2.resize(cap_gstreamer.read()[1], (960, 540))
im1_ffmpeg = cv2.resize(cap_ffmpeg.read()[1], (960, 540))

cap_gstreamer.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second)
cap_ffmpeg.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second)

im2 = cv2.resize(cap_gstreamer.read()[1], (960, 540))
im2_ffmpeg = cv2.resize(cap_ffmpeg.read()[1], (960, 540))

merge_gstreamer = cv2.hconcat([im1, im2])
merge_ffmpeg = cv2.hconcat([im1_ffmpeg, im2_ffmpeg])

cv2.imshow(str(skip_second) + ' gstreamer', merge_gstreamer)
cv2.imshow(str(skip_second) + ' ffmpeg', merge_ffmpeg)
cv2.waitKey(0)
cv2.destroyAllWindows()

cap_gstreamer.release()
cap_ffmpeg.release()



    


    Result :
enter image description here

    


    My cv2 build is like :

    


    >>> print(cv2.getBuildInformation())

General configuration for OpenCV 4.8.1 =====================================
  Version control:               4.8.1-dirty

  Extra modules:
    Location (extra):            /home/alperenlcr/SourceInstalls/opencv_contrib/modules
    Version control (extra):     4.8.1

  Platform:
    Timestamp:                   2024-12-02T13:44:58Z
    Host:                        Linux 6.8.0-49-generic x86_64
    CMake:                       3.22.1
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/gmake
    Configuration:               RELEASE

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (18 files):         + SSSE3 SSE4_1
      SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (8 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (37 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (8 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      NO
    C++ standard:                11
    C++ Compiler:                /usr/bin/c++  (ver 10.5.0)
    C++ flags (Release):         -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined  
    Linker flags (Debug):        -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined  
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/x86_64-linux-gnu/libharfbuzz.so Iconv::Iconv m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/lib/x86_64-linux-gnu -L/usr/lib/cuda/lib64
    3rdparty dependencies:       libprotobuf ade ittnotify libwebp libopenjp2 IlmImf quirc ippiw ippicv

  OpenCV modules:
    To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    cudacodec world
    Disabled by dependency:      -
    Unavailable:                 alphamat cvv hdf java julia matlab ovis python2 sfm viz
    Applications:                tests perf_tests examples apps
    Documentation:               NO
    Non-free algorithms:         NO

  GUI:                           GTK2
    QT:                          NO
    GTK+:                        YES (ver 2.24.33)
      GThread :                  YES (ver 2.72.4)
      GtkGlExt:                  NO
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
    JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
    TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.3.0)
    JPEG 2000:                   build (ver 2.5.0)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES
      avcodec:                   YES (58.134.100)
      avformat:                  YES (58.76.100)
      avutil:                    YES (56.70.100)
      swscale:                   YES (5.9.100)
      swresample:                YES (3.9.100)
    GStreamer:                   YES (1.20.3)
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            TBB (ver 2021.5 interface 12050)

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2021.8 [2021.8.0]
           at:                   /home/alperenlcr/SourceInstalls/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
    Intel IPP IW:                sources (2021.8.0)
              at:                /home/alperenlcr/SourceInstalls/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
    VA:                          NO
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.19.1)
    Flatbuffers:                 builtin/3rdparty (23.5.9)

  NVIDIA CUDA:                   YES (ver 11.5, CUFFT CUBLAS NVCUVID NVCUVENC FAST_MATH)
    NVIDIA GPU arch:             86
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 8.6.0)

  OpenCL:                        YES (no extra features)
    Include path:                /home/alperenlcr/SourceInstalls/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  ONNX:                          NO

  Python 3:
    Interpreter:                 /usr/bin/python3 (ver 3.10.12)
    Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.10.so (ver 3.10.12)
    numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.21.5)
    install path:                lib/python3.10/dist-packages/cv2/python-3.10

  Python (for build):            /usr/bin/python3

  Java:                          
    ant:                         NO
    Java:                        NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /usr/local
-----------------------------------------------------------------



    


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

  • FFmpeg : Specify pixel format for STD_IN input

    27 février 2024, par ShadowMagic896

    This is the current command :

    &#xA;

    ffmpeg -i pipe:0 -pix_fmt yuv420p -f mp4 -vf "transpose=1" -f matroska pipe:1

    &#xA;

    Essentially, it takes an MP4 file, rotates it 90 degrees, and converts it back to mtk and outputs it to STD_OUT.

    &#xA;

    This is the error :

    &#xA;

    WARNING:root:[mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff9979dd00] stream 0, offset 0x50: partial file&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff9979dd00] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 170x144, 32 kb/s): unspecified pixel format&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; (0) and &#x27;probesize&#x27; (5000000) options&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;pipe:0&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: mp41isom&#xA;    creation_time   : 2024-02-26T20:53:03.000000Z&#xA;  Duration: 00:00:03.88, start: 0.000000, bitrate: N/A&#xA;  Stream #0:0[0x1](und): Video: h264 (avc1 / 0x31637661), none, 170x144, 32 kb/s, 30 fps, 30 tbr, 30k tbn (default)&#xA;      Metadata:&#xA;        creation_time   : 2024-02-26T20:53:03.000000Z&#xA;        handler_name    : VideoHandler&#xA;        vendor_id       : [0][0][0][0]&#xA;        encoder         : AVC Coding&#xA;  Stream #0:1[0x2](und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)&#xA;      Metadata:&#xA;        creation_time   : 2024-02-26T20:53:03.000000Z&#xA;        handler_name    : SoundHandler&#xA;        vendor_id       : [0][0][0][0]&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))&#xA;  Stream #0:1 -> #0:1 (aac (native) -> vorbis (libvorbis))&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff9979dd00] stream 0, offset 0x50: partial file&#xA;[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff9978b080] Error during demuxing: Invalid data found when processing input&#xA;Cannot determine format of input 0:0 after EOF&#xA;[vf#0:0 @ 000001ff997d6040] Task finished with error code: -1094995529 (Invalid data found when processing input)&#xA;[vf#0:0 @ 000001ff997d6040] Terminating thread with return code -1094995529 (Invalid data found when processing input)&#xA;[aost#0:1/libvorbis @ 000001ff99cd1780] No filtered frames for output stream, trying to initialize anyway.&#xA;[vost#0:0/libx264 @ 000001ff997d4fc0] Could not open encoder before EOF&#xA;[vost#0:0/libx264 @ 000001ff997d4fc0] Task finished with error code: -22 (Invalid argument)&#xA;[vost#0:0/libx264 @ 000001ff997d4fc0] Terminating thread with return code -22 (Invalid argument)&#xA;[out#0/matroska @ 000001ff997a6180] Nothing was written into output file, because at least one of its streams received no packets.&#xA;frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A    &#xA;Conversion failed!&#xA;

    &#xA;

    I am running this via Python, this is the script :

    &#xA;

        async def send_proc_pipe(self) -> bytes:&#xA;&#xA;        command = f"ffmpeg -hide_banner -loglevel error -i pipe:0 -pix_fmt yuv420p -f mp4 -vf \"transpose=1\" -f matroska pipe:1"&#xA;&#xA;        proc = await asyncio.create_subprocess_shell(&#xA;            cmd=command,&#xA;            stdin=asyncio.subprocess.PIPE,&#xA;            stdout=asyncio.subprocess.PIPE,&#xA;            stderr=asyncio.subprocess.PIPE&#xA;        )&#xA;        &#xA;        std_in = self.blob&#xA;&#xA;        c_out, c_err = await proc.communicate(std_in)&#xA;        if c_err:&#xA;            logging.warning(c_err.decode("utf-8"))&#xA;&#xA;        return c_out&#xA;

    &#xA;

    I'm not really use what else to try here. I've re-ordered the parameters and tried different pixel formats with no success.

    &#xA;