Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (4)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Configuration spécifique pour PHP5

    4 février 2011, par

    PHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
    Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
    Modules spécifiques
    Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)

Sur d’autres sites (2428)

  • Using PNG (which updates) as a source for an RTMP live stream

    24 juillet 2023, par pkSML

    I've been googling a lot lately trying but I have yet to find a solution.

    


    I've been using OBS to stream some textual data, where it grabs some data from a webpage and dynamically updates. This is easy, but involves way more overhead and CPU usage than I want. So cue up the command line and FFMPEG. I've gotten a script that'll update this textual information for me and save as a PNG. It updates every 10 seconds. The PNG file is 1280x720.

    


    All I want on my RTMP stream is this image (with audio). But I can't figure out how to use only a PNG as the source of a video stream.

    


    This does NOT work :
ffmpeg -re -y -framerate 1 -loop 1 -f image2 -i "./image.png" -c:v libx264 -pix_fmt yuv420p -preset fast -r 30 -g 120 -b:v 1000k -bufsize 512k -f flv "rtmps://mydomain.com/endpoint"
This just stalls. The encode time goes nowhere and the frame counter hardly moves.

    


    I want this to be compatible with Facebook Live, so I need the output to be 30 fps with GOPs every few seconds.

    


    Any ideas on how to achieve this ? I could use an overlay, but I'd prefer not to.

    


    Thanks !

    


  • error with ffmpeg converting images to video

    1er mai 2023, par Megan Darcy

    I have this code that I am using to convert multiple images in different folders into videos. this is the code i have :

    


    counter = 0
list_of_videos = os.listdir('./Pending/')

# obtain list of completed videos and strip extensions 
completed_mp4s = os.listdir('./outputvideos/')
completed_mp4s = [x[:len(x) - 4] for x in completed_mp4s]

# for videos that haven't been created, create video! if it exists, skip creation process
framerate = 30


for video in list_of_videos:
    if video not in completed_mp4s:
        counter += 1
        inputos = "ffmpeg -framerate " + str(framerate) + " -pattern_type sequence -i ./Pending/" + video + "/" + video + ".%d.png -c:v libx264 -pix_fmt yuv420p ./outputvideos/" + video + ".mp4"
        os.system(inputos)

print(counter)


    


    however I have the same issue as this FFMPEG "Could find no file with path" and "No such file or directory"

    


    The images are named as follows :

    


    image of names

    


    and the error I receive is this :

    


    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
[image2 @ 000001dbf1f854c0] Could find no file with path './Pending/WYZCW_Colored_Lights_Left/WYZCW_Colored_Lights_Left.%d.png' and index in the range 0-4
./Pending/WYZCW_Colored_Lights_Left/WYZCW_Colored_Lights_Left.%d.png: No such file or directory


    


    This is my folder structure :

    


    folder structr

    


    but when I tried the solutions provided , like changing the %04 to %4d or %d, the same problem persists. Does anyone know how I can fix this ?

    


    Thank you ! :)

    


  • What should I do to handle audio&video in a radio automation software ?

    24 avril 2023, par TheDaChicken

    I am currently working on a program that can be deemed as a "radio automation software."
Radio automation software focuses on audio. It may split audio frames and crossfade between different audio sources.

    


    I want to continue by adding video support for music videos. This makes it not completely about audio.

    


    There is a problem with this. Having audio porition do it's thing while video can be added along side it is difficult. For example, having access to the previous track to be able to crossfade & preloading the song.

    


    This is what I currently have which is being run in a thread.

    


    int ret;&#xA;int tryCounter{0};&#xA;int64_t end_pts{AV_NOPTS_VALUE};&#xA;int64_t end_duration{AV_NOPTS_VALUE};&#xA;while(true) {&#xA;        std::shared_ptr<cmessage> message;&#xA;&#xA;        ret = queue.Get(message, MessageQueue::MessageQueueFlags::MSQ_NON_BLOCK);&#xA;        if (ret &lt; 0) {&#xA;            if(ret == MessageQueue::MessageQueueRET::MSQ_STOPPED)&#xA;                break;&#xA;            Logger::Log(LOGWARNING, "Playback thread received: {}", ret);&#xA;            break;&#xA;        }&#xA;&#xA;        if (ret == MessageQueue::MessageQueueRET::MSQ_OK &amp;&amp; message) {&#xA;            if (message->IsType(CMessage::PLAY_SONG)) {&#xA;                /* It was requested for the Player to play a new song */&#xA;                std::shared_ptr<cmessageplaysong> songMsg = std::static_pointer_cast<cmessageplaysong>(message);&#xA;                // steal session :D&#xA;                std::unique_ptr<playersession> playerSession = std::move(songMsg->GetSession());&#xA;                if (!playerSession->GetTrack()) {&#xA;                    Logger::Log(LOGWARNING, "PlaybackThread: Ignoring playback song event due to null track");&#xA;                    goto SEND_NEXT_SONG;&#xA;                }&#xA;                if(!playerSession->GetPlaylist())&#xA;                    playerSession->SetPlaylist(m_player->GetPlaylist());&#xA;                if (playerSession->IsPreloaded())&#xA;                    Logger::Log(LOGDEBUG, "PlaybackThread: Received preloaded track.");&#xA;&#xA;                // load track if not loaded already&#xA;                if (!playerSession->Open(playerSession->GetTrack(),&#xA;                                         m_info)) {&#xA;                    Logger::Log(LOGERROR, "Failed to open input");&#xA;                    goto SEND_NEXT_SONG;&#xA;                }&#xA;&#xA;                preloadRequestSent = false;&#xA;                m_nextSession = nullptr;&#xA;&#xA;                std::shared_ptr<track> track = playerSession->GetTrack();&#xA;                track->start_sample = m_player->GetMainOutput()->GetWrittenSamples();&#xA;                track->played = true;&#xA;                // Send current song position to callback thread for the callback function to be run when song starts playing&#xA;                m_player->SendSongPosition(playerSession->GetTrack(), playerSession->GetPlaylist(),&#xA;                                 playerSession->GetTrackPosition());&#xA;&#xA;                // Grab the old one&#xA;                std::unique_ptr<playersession> oldSession = std::move(m_currentSession);&#xA;                // Set current audio instance to this input&#xA;                m_currentSession.swap(playerSession);&#xA;&#xA;                // Crossfade :D&#xA;                ret = CrossFade(oldSession, m_currentSession);&#xA;                if (ret == STREAM_MAX) {&#xA;                    // when the new song goes brrrrr.&#xA;                    // this rarely happens anyway SOO&#xA;                    m_currentSession.swap(oldSession);&#xA;                    goto SEND_NEXT_SONG;&#xA;                }&#xA;&#xA;                end_pts = AV_NOPTS_VALUE;&#xA;                end_duration = m_currentSession->GetDuration();&#xA;                if(m_currentSession->GetTrack()->info.segue_time != AV_NOPTS_VALUE)&#xA;                {&#xA;                    end_duration = m_currentSession->GetTrack()->info.segue_time;&#xA;                    // this is end duration for max samples :D&#xA;                    // this variable is dependent on timebase&#xA;                    end_pts = av_rescale_q(end_duration, CPPAV_TIME_BASE_Q, m_currentSession->GetTimeBase());&#xA;                }&#xA;            }&#xA;            if (message->IsType(CMessage::NEXT_SONG)) {&#xA;                /* request for the thread to play song next */&#xA;                std::shared_ptr<cmessagenextsong> messageNextSong = std::static_pointer_cast<cmessagenextsong>(message);&#xA;                // steal session :D&#xA;                m_nextSession = std::move(messageNextSong->GetSession());&#xA;            }&#xA;        }&#xA;&#xA;        if (!m_currentSession) {&#xA;            /* wait until there is a track that can be played */&#xA;            /* during this, portaudio should not be opened */&#xA;            m_player->GetMainOutput()->OpenPlayback(false);&#xA;            std::this_thread::sleep_for(std::chrono::milliseconds(50));&#xA;            continue;&#xA;        }&#xA;        /* there is input so output should be active */&#xA;        if (!m_player->GetMainOutput()->IsActive()) {&#xA;            m_player->GetMainOutput()->OpenPlayback(true);&#xA;        }&#xA;&#xA;        ret = m_currentSession->Decode(m_frame, end_pts);&#xA;        if (ret == STREAM_WAIT) {&#xA;            continue;&#xA;        } else if (ret == STREAM_EOF || ret == STREAM_MAX) {&#xA;            SEND_NEXT_SONG:&#xA;            if(m_player->GetCurrentTrack())&#xA;                m_player->GetCurrentTrack()->end_sample = m_player->GetMainOutput()->GetWrittenSamples();&#xA;            // Wait until the next song is in the queue for playback&#xA;            QueueNextSong(false);&#xA;            continue;&#xA;        }&#xA;        else if (ret == STREAM_ERROR) { // check &amp; handle errors&#xA;            tryCounter&#x2B;&#x2B;;&#xA;            Logger::Log(LOGERROR, "Decoder replied: Error try counter: {}/{}",&#xA;                        tryCounter, MAX_ERROR_COUNTER);&#xA;            if (tryCounter >= MAX_ERROR_COUNTER) {&#xA;                goto SEND_NEXT_SONG;&#xA;            }&#xA;            continue;&#xA;        }&#xA;        tryCounter = 0;&#xA;&#xA;        int64_t timestamp = 0;&#xA;        if (m_frame->GetPTS() != AV_NOPTS_VALUE) // must convert timestamp to static time base :D makes things easier&#xA;            timestamp = av_rescale_q(m_frame->GetPTS(), m_frame->GetTimeBase(), CPPAV_TIME_BASE_Q);&#xA;&#xA;        // Check if track is about to end to preload next track&#xA;        // TODO make 3 changeable for preloading :)))&#xA;        if (!preloadRequestSent &amp;&amp; timestamp >= end_duration - (3 * AV_TIME_BASE)) {&#xA;            Logger::Log(LOGDEBUG, "Sending next track to preload thread");&#xA;            if (QueueNextSong(true))&#xA;                preloadRequestSent = true;&#xA;        }&#xA;&#xA;        // Write frame into ringbuffer&#xA;        ret = m_player->WriteFrame(m_frame);&#xA;        assert(ret != STREAM_EOF);&#xA;        // Clean out frame :)&#xA;        m_frame->Reset();&#xA;    }&#xA;</cmessagenextsong></cmessagenextsong></playersession></track></playersession></cmessageplaysong></cmessageplaysong></cmessage>

    &#xA;

    It seems awkward already. I have a huge amount of code for preparing the song. I have to keep track of the end duration and the next song. I have to keep track of the playlist. I am using PlayerSession to grab audio frames, handle all audio packet decoding, resampling to a constant sample rate. I don't think that is going to be viable to keep.

    &#xA;