Recherche avancée

Médias (91)

Autres articles (63)

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

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (6224)

  • OpenCV 4.5.2 takes a long time (>100ms) to retrieve a single frame from a webcam, C++ on Windows 10

    9 juin 2021, par Mustard Tiger

    I've been having a tough time getting my webcam working quickly with opencv. Frames take a very long time to read, (a recorded average of 124ms across 500 frames) I've tried on three different computers (running Windows 10) with a logitech C922 webcam. The most recent machine I tested on has a Ryzen 9 3950X, with 32gbs of ram ; no lack of power.

    


    Here is the code :

    


    cv::VideoCapture cap = cv::VideoCapture(m_cameraNum);&#xA;&#xA;// Check if camera opened successfully&#xA;if (!cap.isOpened())&#xA;{&#xA;    m_logger->critical("Error opening video stream or file\n\r");&#xA;    return -1;&#xA;}&#xA;&#xA;bool result = true;&#xA;result &amp;= cap.set(cv::CAP_PROP_FRAME_WIDTH, 1280);&#xA;result &amp;= cap.set(cv::CAP_PROP_FRAME_HEIGHT, 720);&#xA;&#xA;bool ready = false;&#xA;std::vector<string> timeLog;&#xA;timeLog.reserve(50000);&#xA;int i = 0;&#xA;&#xA;while (i &lt; 500)&#xA;{&#xA;    auto start = std::chrono::system_clock::now();&#xA;    &#xA;    cv::Mat img;&#xA;    ready = cap.read(img);&#xA;&#xA;    // If the frame is empty, break immediately&#xA;    if (!ready)&#xA;    {&#xA;        timeLog.push_back("continue");&#xA;        continue;&#xA;    }&#xA;&#xA;    i&#x2B;&#x2B;;&#xA;    auto end = std::chrono::system_clock::now();&#xA;    timeLog.push_back(std::to_string(std::chrono::duration_cast(end - start).count()));&#xA;}&#xA;&#xA;for (auto&amp; entry : timeLog)&#xA;    m_logger->info(entry);&#xA;&#xA;cap.release();&#xA;return 0;&#xA;</string>

    &#xA;

    Notice that I write the elapsed time to a log file at the end of execution. The average time is 124ms for debug and release, and not one instance of "continue" after half a dozen runs.

    &#xA;

    It doesn't matter if I use USB 2 or USB 3 ports (the camera is USB2) or if I run a debug build or a release build, the log file will show anywhere from 110ms to 130ms of time for each frame. The camera works fine in other app, OBS can get a smooth 1080@30fps or 720@60fps.

    &#xA;

    Stepping through the debugger and doing a lot of Googling, I've learned the following about my system :

    &#xA;

      &#xA;
    • The backend chosen by default is DSHOW. GStreamer and FFMPEG are also available.
    • &#xA;

    • DSHOW uses FFMPEG somehow (it needs the FFMPEG dll) but I cannot use FFMPEG directly through opencv. Attempting to use cv::VideoCapture(m_cameraNum, cv::CAP_FFMPEG) always fails. It seems like Opencv's interface to FFMPEG is only capable of opening video files.
    • &#xA;

    • Microsoft really screwed up camera devices in Windows a few years back, not sure if this is related to my problem.
    • &#xA;

    &#xA;

    Here's a short list of the fixes I have tried, most taken from older SO posts :

    &#xA;

      &#xA;
    • result &= cap.set(cv::CAP_PROP_FRAME_COUNT, 30) ; // Returns false, does nothing
    • &#xA;

    • result &= cap.set(cv::CAP_PROP_CONVERT_RGB, 0) ; // Returns true, does nothing
    • &#xA;

    • result &= cap.set(cv::CAP_PROP_MODE, cv::VideoWriter::fourcc('M', 'J', 'P', 'G')) ; // Returns false, does nothing
    • &#xA;

    • Set registry key from http://alax.info/blog/1693 that should disable the new Windows camera server.
    • &#xA;

    • Updated from 4.5.0 to 4.5.2, no change.
    • &#xA;

    • Asked device manager to find a newer driver, no newer driver found.
    • &#xA;

    &#xA;

    I'm out of ideas. Any help ?

    &#xA;

  • ffmpeg skips frames/packets while playing a file over http

    24 janvier 2020, par coban
    Microsoft Windows [Version 10.0.18362.592]  
    libavutil      56. 31.100 / 56. 31.100
    libavcodec     58. 54.100 / 58. 54.100
    libavformat    58. 29.100 / 58. 29.100
    libavdevice    58.  8.100 / 58.  8.100
    libavfilter     7. 57.100 /  7. 57.100
    libswscale      5.  5.100 /  5.  5.100
    libswresample   3.  5.100 /  3.  5.100
    libpostproc    55.  5.100 / 55.  5.100
    [hls @ 0600cac0] Skip ('#EXT-X-VERSION:3')    0KB sq=    0B f=0/0
    [hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/chunklist_w1481451763.m3u8' for reading
    [hls @ 0600cac0] Skip ('#EXT-X-VERSION:3')    0KB sq=    0B f=0/0
    [hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_0.ts' for reading
    [hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_1.ts' for reading
    Input #0, hls, from 'http://ok2.se:8000/movie/xxxxxxxxxx/67933.m3u8':
    Duration: 02:02:22.46, start: 0.000000, bitrate: N/A
    Program 0
    Metadata: 0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0
     variant_bitrate : 2788912
    Stream #0:0: Data: timed_id3 (ID3  / 0x20334449)
    Metadata:
     variant_bitrate : 2788912
    Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Metadata:
     variant_bitrate : 2788912
    Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
     variant_bitrate : 2788912
    [http @ 060662c0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_2.ts' for reading
    [hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_2.ts' for reading
    [http @ 0606fb40] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_3.ts' for reading
    [hls @ 0600cac0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_3.ts' for reading
    [http @ 0c2442c0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_4.ts' for reading
    [http @ 0606f8c0] Opening 'http://198.144.145.236:1935/ondemand-1/_definst_/mp4:path2/FRENCH.MOVIES/2017.JOHN.WICK.CHAPTER.2.FRN.mp4/media_w1481451763_5.ts' for reading

    I am trying to create an A/V player using ffmpeg library and Delphi. After puzzling and puzzling I found out how to read/decode/sync/display etc...

    I think this behaviour is in some specific situations, because I tested live streams and noticed no problems. In this case this is a video file, while playing my app and ffplay.exe (from ffmpeg not compiled by myself) behaving the same, and skipping packets "every time when the app has to wait while packetqueue is full ?" and loses about 10-30 seconds of audio and video.

    VLC doesn’t seem to have such a like behaviour, while as I understand from VLC credits, they are using ffmpeg or ffmpeg methods imported for decoding/encoding. inspecting vlc source doesn’t make much sense for me because I am a (noob) Delphi programmer. It’s like my main language is Dutch and try to translate form French to German language.

    Please any suggestions how to avoid this, because I think it has to do something with delivery of data from the server and/or read buffer of ffmpeg. If I increase the max size of packetqueue the skipping does happen later and if decrease the size, the skipping happens sooner.

    Including code from my app is not necessary because ffplay.exe has exact the same behavior. You can see debug from ffplay.exe.

  • Pydub FFMPEG issue [closed]

    14 janvier, par Nikolai van den Hoven

    I am attempting to use FFMPEG with Pydub to create a program that chops .mp3 files into different words, each contained in their own .mp3 file, but when I run the script I am getting the following error :

    &#xA;

    PS C:\Users\nik> &amp; C:/Users/nik/AppData/Local/Microsoft/WindowsApps/python3.12.exe "d:/Python/Word Splitter.py"&#xA;C:\Users\nik\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn&#x27;t find ffmpeg or avconv - defaulting to ffmpeg, but may not work&#xA;  warn("Couldn&#x27;t find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)&#xA;

    &#xA;

    This is the code I am using.

    &#xA;

    import os&#xA;from pydub import AudioSegment&#xA;from pydub.silence import split_on_silence&#xA;import speech_recognition as sr&#xA;AudioSegment.ffmpeg = r"D:\Python\ffmpeg\bin\ffmpeg.exe"&#xA;def mp3_to_words(mp3_file, output_folder):&#xA;    # Ensure output folder exists&#xA;    os.makedirs(output_folder, exist_ok=True)&#xA;&#xA;    # Load MP3 file&#xA;    print("Loading audio file...")&#xA;    audio = AudioSegment.from_mp3(mp3_file)&#xA;&#xA;    # Split audio into chunks using silence detection&#xA;    print("Splitting audio into chunks...")&#xA;    chunks = split_on_silence(&#xA;        audio,&#xA;        min_silence_len=200,  # Minimum silence duration in ms to consider as a split point&#xA;        silence_thresh=audio.dBFS - 14,  # Silence threshold relative to average loudness&#xA;        keep_silence=100  # Retain some silence in chunks&#xA;    )&#xA;&#xA;    recognizer = sr.Recognizer()&#xA;&#xA;    for i, chunk in enumerate(chunks):&#xA;        print(f"Processing chunk {i &#x2B; 1}/{len(chunks)}...")&#xA;&#xA;        # Save the chunk temporarily&#xA;        temp_file = os.path.join(output_folder, f"chunk_{i}.wav")&#xA;        chunk.export(temp_file, format="wav")&#xA;&#xA;        # Recognize words in the chunk&#xA;        with sr.AudioFile(temp_file) as source:&#xA;            audio_data = recognizer.record(source)&#xA;            try:&#xA;                text = recognizer.recognize_google(audio_data)&#xA;                words = text.split()&#xA;&#xA;                # Export each word as its own MP3&#xA;                word_start = 0&#xA;                for j, word in enumerate(words):&#xA;                    word_duration = len(chunk) // len(words)  # Approximate duration per word&#xA;                    word_audio = chunk[word_start:word_start &#x2B; word_duration]&#xA;                    word_file = os.path.join(output_folder, f"word_{i}_{j}.mp3")&#xA;                    word_audio.export(word_file, format="mp3")&#xA;                    word_start &#x2B;= word_duration&#xA;&#xA;            except sr.UnknownValueError:&#xA;                print(f"Could not understand chunk {i &#x2B; 1}.")&#xA;            except sr.RequestError as e:&#xA;                print(f"Could not request results; {e}")&#xA;&#xA;        # Clean up temporary file&#xA;        os.remove(temp_file)&#xA;&#xA;    print(f"Processed {len(chunks)} chunks. Word MP3s saved in {output_folder}.")&#xA;&#xA;if __name__ == "__main__":&#xA;    input_file = input("Enter the path to the MP3 file: ").strip()&#xA;    output_dir = input("Enter the output folder path: ").strip()&#xA;&#xA;    mp3_to_words(input_file, output_dir)&#xA;

    &#xA;

    I have added the Base FFMPEG folder and the bin folder within it to Windows PATH&#xA;My PATH variable on Windows 11,&#xA;But it does not show up in the variable when I typed PATH into cmd

    &#xA;