Recherche avancée

Médias (0)

Mot : - Tags -/serveur

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

Autres articles (84)

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

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

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (9017)

  • value of got_picture_ptr is always 0. when use avcodec_decode_video2()

    4 septembre 2014, par user3867261

    I’m using visual studio 2013 professional.

    below code is simple decode tutorial using ffmpeg.

    ///> Include FFMpeg
    extern "C" {
    #include <libavformat></libavformat>avformat.h>
    }

    ///> Library Link On Windows System
    #pragma comment( lib, "avformat.lib" )  
    #pragma comment( lib, "avutil.lib" )
    #pragma comment( lib, "avcodec.lib" )

    static void write_ascii_frame(const char *szFileName, const AVFrame *pVframe);

    int main(void)
    {
       const char *szFilePath = "C:\\singlo\\example.avi";

       ///> Initialize libavformat and register all the muxers, demuxers and protocols.
       av_register_all();

       ///> Do global initialization of network components.
       avformat_network_init();

       int ret;
       AVFormatContext *pFmtCtx = NULL;

       ///> Open an input stream and read the header.
       ret = avformat_open_input( &amp;pFmtCtx, szFilePath, NULL, NULL );
       if( ret != 0 ) {
           av_log( NULL, AV_LOG_ERROR, "File [%s] Open Fail (ret: %d)\n", ret );
           exit( -1 );
       }
       av_log( NULL, AV_LOG_INFO, "File [%s] Open Success\n", szFilePath );
       av_log( NULL, AV_LOG_INFO, "Format: %s\n", pFmtCtx->iformat->name );

       ///> Read packets of a media file to get stream information.
       ret = avformat_find_stream_info( pFmtCtx, NULL );
       if( ret &lt; 0 ) {
           av_log( NULL, AV_LOG_ERROR, "Fail to get Stream Information\n" );
           exit( -1 );
       }
       av_log( NULL, AV_LOG_INFO, "Get Stream Information Success\n" );

       ///> Find Video Stream
       int nVSI = -1;
       int nASI = -1;
       int i;
       for( i = 0 ; i &lt; pFmtCtx->nb_streams ; i++ ) {
           if( nVSI &lt; 0 &amp;&amp; pFmtCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO ) {
               nVSI = i;
           }
           else if( nASI &lt; 0 &amp;&amp; pFmtCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO ) {
               nASI = i;
           }
       }

       if( nVSI &lt; 0 &amp;&amp; nASI &lt; 0 ) {
           av_log( NULL, AV_LOG_ERROR, "No Video &amp; Audio Streams were Found\n");
           exit( -1 );
       }

       ///> Find Video Decoder
       AVCodec *pVideoCodec = avcodec_find_decoder( pFmtCtx->streams[nVSI]->codec->codec_id );
       if( pVideoCodec == NULL ) {
           av_log( NULL, AV_LOG_ERROR, "No Video Decoder was Found\n" );
           exit( -1 );
       }

       ///> Initialize Codec Context as Decoder
       if( avcodec_open2( pFmtCtx->streams[nVSI]->codec, pVideoCodec, NULL ) &lt; 0 ) {
           av_log( NULL, AV_LOG_ERROR, "Fail to Initialize Decoder\n" );
           exit( -1 );
       }

       ///> Find Audio Decoder
       AVCodec *pAudioCodec = avcodec_find_decoder( pFmtCtx->streams[nASI]->codec->codec_id );
       if( pAudioCodec == NULL ) {
           av_log( NULL, AV_LOG_ERROR, "No Audio Decoder was Found\n" );
           exit( -1 );
       }

       ///> Initialize Codec Context as Decoder
       if( avcodec_open2( pFmtCtx->streams[nASI]->codec, pAudioCodec, NULL ) &lt; 0 ) {
           av_log( NULL, AV_LOG_ERROR, "Fail to Initialize Decoder\n" );
           exit( -1 );
       }

       AVCodecContext *pVCtx = pFmtCtx->streams[nVSI]->codec;
       AVCodecContext *pACtx = pFmtCtx->streams[nASI]->codec;

       AVPacket pkt;
       AVFrame* pVFrame, *pAFrame;
       int bGotPicture = 0;    // flag for video decoding
       int bGotSound = 0;      // flag for audio decoding

       int bPrint = 0; // ë¹ëì¤ ì²« ì¥ë©´ë§ íì¼ë¡ ë¨ê¸°ê¸° ìí ìì flag ìëë¤

       pVFrame = avcodec_alloc_frame();
       pAFrame = avcodec_alloc_frame();

       while( av_read_frame( pFmtCtx, &amp;pkt ) >= 0 ) {
           ///> Decoding
           if( pkt.stream_index == nVSI ) {
               if( avcodec_decode_video2( pVCtx, pVFrame, &amp;bGotPicture, &amp;pkt ) >= 0 ) {
          ///////////////////////problem here/////////////////////////////////////////////
                   if( bGotPicture ) {
                       ///> Ready to Render Image
                       av_log( NULL, AV_LOG_INFO, "Got Picture\n" );
                       if( !bPrint ) {
                           write_ascii_frame( "output.txt", pVFrame );
                           bPrint = 1;
                       }
                   }
               }
               // else ( &lt; 0 ) : Decoding Error
           }
           else if( pkt.stream_index == nASI ) {
               if( avcodec_decode_audio4( pACtx, pAFrame, &amp;bGotSound, &amp;pkt ) >= 0 ) {
                   if( bGotSound ) {
                       ///> Ready to Render Sound
                       av_log( NULL, AV_LOG_INFO, "Got Sound\n" );
                   }
               }
               // else ( &lt; 0 ) : Decoding Error
           }

           ///> Free the packet that was allocated by av_read_frame
           av_free_packet( &amp;pkt );
       }

       av_free( pVFrame );
       av_free( pAFrame );

       ///> Close an opened input AVFormatContext.
       avformat_close_input( &amp;pFmtCtx );

       ///> Undo the initialization done by avformat_network_init.
       avformat_network_deinit();

       return 0;
    }

    static void write_ascii_frame(const char *szFileName, const AVFrame *frame)
    {
       int x, y;
       uint8_t *p0, *p;
       const char arrAsciis[] = " .-+#";

       FILE* fp = fopen( szFileName, "w" );
       if( fp ) {
           /* Trivial ASCII grayscale display. */
           p0 = frame->data[0];        
           for (y = 0; y &lt; frame->height; y++) {
               p = p0;
               for (x = 0; x &lt; frame->width; x++)
                   putc( arrAsciis[*(p++) / 52], fp );
               putc( '\n', fp );
               p0 += frame->linesize[0];
           }
           fflush(fp);
           fclose(fp);
       }
    }

    there is a problem in below part

    if( avcodec_decode_video2( pVCtx, pVFrame, &amp;bGotPicture, &amp;pkt ) >= 0 ) {
          ///////////////////////problem here/////////////////////////////////////////////
          if( bGotPicture ) {
                ///> Ready to Render Image
               av_log( NULL, AV_LOG_INFO, "Got Picture\n" );
               if( !bPrint ) {
                    write_ascii_frame( "output.txt", pVFrame );
                    bPrint = 1;
                }
           }
    }

    the value of bGotPicture is always 0.. So i can’t decode video
    plz help me.
    where do problem occurs from ? in video ? in my code ?

  • Low latency video player on android

    20 mai 2021, par Louis Blenner

    I'd like to be able to stream the video from my webcam to an Android app with a latency below 500ms, on my local network.

    &#xA;

    To capture and send the video over the network, I use ffmpeg.

    &#xA;

    ffmpeg -f v4l2 -i /dev/video0 -preset ultrafast -tune zerolatency -vcodec libx264 -an -vf format=yuv420p -f mpegts  udp://192.168.1.155:5000&#xA;

    &#xA;

    This command takes the webcam as an input, convert it and send it to a device using the mpegts protocol.
    &#xA;This is not a requirement, if another technique could work, I could change the way I send the video.

    &#xA;

    I am able to read the video on another PC from the local network with a latency below 500 ms, using commands like

    &#xA;

    gst-launch-1.0 -v udpsrc port=5000 ! video/mpegts ! tsdemux ! h264parse ! avdec_h264 ! fpsdisplaysink sync=false&#xA;

    &#xA;

    or

    &#xA;

    mpv udp://0.0.0.0:5000 --no-cache --untimed --no-demuxer-thread --video-sync=audio --vd-lavc-threads=1 &#xA;

    &#xA;

    So it is possible to have this range of latency.
    &#xA;I'd like to have the same thing on Android.

    &#xA;

    Here are my tries to do that.

    &#xA;

    Exoplayer

    &#xA;

    After looking at the different players available on Android studio, it seems like Exoplayer is the go-to choice.
    &#xA;I tried different options indicated in the live-streaming documentation, but I always end up with a stream taking seconds to start and with a latency of seconds.
    &#xA;I tried to add a Button to seek to the default position of the windows, but it results in a loading of several seconds.

    &#xA;

    DefaultExtractorsFactory extractorsFactory =&#xA;                new DefaultExtractorsFactory()&#xA;                        .setTsExtractorFlags(DefaultTsPayloadReaderFactory.FLAG_IGNORE_AAC_STREAM);&#xA;&#xA;        player = new SimpleExoPlayer.Builder(this)&#xA;                .setMediaSourceFactory(&#xA;                        new DefaultMediaSourceFactory(this, extractorsFactory))&#xA;                .setLoadControl(new DefaultLoadControl.Builder()&#xA;                        .setBufferDurationsMs(DefaultLoadControl.DEFAULT_MIN_BUFFER_MS, DefaultLoadControl.DEFAULT_MAX_BUFFER_MS, 200, 200)&#xA;                        .build())&#xA;                .build();&#xA;        MyPlayerView playerView = findViewById(R.id.player_view);&#xA;        // Bind the player to the view.&#xA;        playerView.setPlayer(player);&#xA;        // Build the media item.&#xA;        MediaItem mediaItem = new MediaItem.Builder()&#xA;                .setUri(Uri.parse("udp://0.0.0.0:5000"))&#xA;                .setLiveMaxOffsetMs(500)&#xA;                .setLiveTargetOffsetMs(0)&#xA;                .setLiveMinOffsetMs(0)&#xA;                .build();&#xA;        // Set the media item to be played.&#xA;        player.setMediaItem(mediaItem);&#xA;        // Prepare the player.&#xA;        player.setPlayWhenReady(true);&#xA;        player.prepare();&#xA;        //player.seekToDefaultPosition();&#xA;

    &#xA;

    This issue is about the same issue and the conclusion was that Exoplayer was not fit for this use case.

    &#xA;

    &#xA;

    I'll be honest, ultra low-latency like this isn't ExoPlayer's main use-case

    &#xA;

    &#xA;

    Vlc

    &#xA;

    Another try was to use the Vlc library.
    &#xA;But I was unable to have the same low latency stream as with the two previous players with Vlc.
    &#xA;I tried changing the preferences of Vlc to stream as fast as possible as described here

    &#xA;

    Input/Codecs -> x264 preset: ultrafast - zerolatency&#xA;Input/Codecs -> Access Module: UDP input&#xA;Input/Codecs -> Clock Jitter: 500&#xA;Audio: disable audio&#xA;

    &#xA;

    I also tried reducing the different buffers.
    &#xA;However, I still have a latency of more than 1 seconds with that.

    &#xA;

    Gstreamer

    &#xA;

    Another try was to create a react-native project to use the different players available here.
    &#xA;One player that seemed promising was react-native-gstreamer because it uses gstreamer which is able to stream with low latency (gst-launch command).
    &#xA;But the library is now outdated.

    &#xA;

    Question

    &#xA;

    There were other tries, but none were successful.
    &#xA;Is there a problem with one of my approaches ?
    &#xA;And if not, Is there a player on Android (that I missed) which is able to achieve low latency stream like gstream or mpv on linux ?

    &#xA;

  • Concatenate / Join MP4 files using ffmpeg and windows command line batch NOT LINUX

    10 septembre 2022, par julesverne

    I've written a batch script that attempts to take a generic introductory title video (MP4) that runs for 12 seconds and attaches it to the beginning of 4 other MP4 videos (same video but each has a different language audio track)

    &#xA;&#xA;

    According to ffmpeg syntax here : http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20concatenate%20%28join,%20merge%29%20media%20files the concat demuxer needs to be run from a text file that looks like this :

    &#xA;&#xA;

    # this is a comment&#xA;file &#x27;/path/to/file1&#x27;&#xA;file &#x27;/path/to/file2&#x27;&#xA;file &#x27;/path/to/file3&#x27;&#xA;

    &#xA;&#xA;

    I believe everything in my script up until the point of joining the files appears to be working correctly. But I get this error :

    &#xA;&#xA;

    [concat @ 04177d00] Line 2: unknown keyword &#x27;&#x27;C:\Users\Joe\1May\session3\readyforfinalconversion\frenchfile.mp4&#x27;&#xA;filelistFrench.txt: Invalid data found when processing input&#xA;[concat @ 03b70a80] Line 2: unknown keyword &#x27;&#x27;C:\Users\Joe\1May\session3\readyforfinalconversion\spanishfile.mp4&#x27;&#xA;filelistSpanish.txt: Invalid data found when processing input&#xA;[concat @ 0211b960] Line 2: unknown keyword &#x27;&#x27;C:\Users\Joe\1May\session3\readyforfinalconversion\basquefile.mp4&#x27;&#xA;filelistBasque.txt: Invalid data found when processing input&#xA;[concat @ 03a20a80] Line 2: unknown keyword &#x27;&#x27;C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4&#x27;&#xA;filelistEnglish.txt: Invalid data found when processing input&#xA;

    &#xA;&#xA;

    I believe the issue lies in the text file I'm creating. Please excuse my n00b ignorance, but sometimes new script makers like myself get confused about developer jargon and may take things literally.

    &#xA;&#xA;

    So when I look at that example text file they gave, am I correct in thinking THIS is what my text file should look like ?

    &#xA;&#xA;

    # this is a comment&#xA;Titlefile.mp4 &#x27;C:\Users\Joe\1May\session3\readyforfinalconversion\Titlefile.mp4&#x27;&#xA;Englishfile.mp4 &#x27;C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4&#x27;&#xA;

    &#xA;&#xA;

    Again, am I being too literal ? are the quotations correct ? Are the slashes correct ? In the example they provide the slashes in the path are / instead of normal windows \ . I'll provide the entire script in case it helps.

    &#xA;&#xA;

    @echo off&#xA;&#xA;setlocal EnableDelayedExpansion&#xA;&#xA;rem Create an array of languages&#xA;set i=0&#xA;for %%a in (French Spanish Basque English) do (&#xA;   set /A i&#x2B;=1&#xA;   set term[!i!]=%%a&#xA;)&#xA;&#xA;rem Get the title video file name from user&#xA;&#xA;set /p titlevideofilename=What is the title video file &#xA;&#xA;name?&#xA;&#xA;rem create a path variable for the title video file&#xA;&#xA;set pathtotitlevideo=%~dp0%titlevideofilename%&#xA;&#xA;rem Get the names of the different language video files to append to the title video&#xA;rem create a path variable for each different language video files&#xA;&#xA;for /L %%i in (1,1,4) do (&#xA;   set /p language[%%i]=what is the name of the !term&#xA;&#xA;[%%i]! file you want to append after the title video?&#xA;   set pathtofile[%%i]=%~dp0!language[%%i]!&#xA;)&#xA;&#xA;rem create data file for ffmpeg based on variable data&#xA;&#xA;for /L %%i in (1,1,4) do (&#xA;    echo # this is a comment>>filelist!term[%&#xA;&#xA;%i]!.txt&#xA;    echo file &#x27;%pathtotitlevideo%&#x27;>>filelist!term[%&#xA;&#xA;%i]!.txt&#xA;    echo file &#x27;!pathtofile[%%i]!&#x27;>>filelist!term[%&#xA;&#xA;%i]!.txt&#xA;)&#xA;&#xA;cls&#xA;&#xA;rem join files using ffmpeg concat option&#xA;&#xA;for /L %%i in (1,1,4) do (&#xA;   c:\ffmpeg\ffmpeg\bin\ffmpeg.exe -loglevel error -f &#xA;&#xA;concat -i filelist!term[%%i]!.txt -c copy !language[%&#xA;&#xA;%i]!.!term[%%i]!.withtitle.mp4&#xA;)&#xA;&#xA;endlocal&#xA;&#xA;:eof&#xA;exit&#xA;

    &#xA;&#xA;

    EDIT
    &#xA;Thanks to @foxidrive making me look at the simplicity of it... it occurred to me that Apparently I wasn't being literal enough. I made these 3 changes and script works perfectly now&#xA;1 : "file" in there example literally meant the word "file" &#xA;2 : needed the use of single quotes not double quotes as it shows in there example. &#xA;3 : Used "\" instead of "/" as they have in there example.

    &#xA;&#xA;

    So NOW my code to create the text files looks like this :

    &#xA;&#xA;

    rem create data file for ffmpeg based on variable data&#xA;&#xA;for /L %%i in (1,1,4) do (&#xA;    echo # this is a comment>>filelist!term[%&#xA;&#xA;%i]!.txt&#xA;    echo file &#x27;%pathtotitlevideo%&#x27;>>filelist!term[%&#xA;&#xA;%i]!.txt&#xA;    echo file &#x27;!pathtofile[%%i]!&#x27;>>filelist!term[%&#xA;&#xA;%i]!.txt&#xA;)&#xA;

    &#xA;&#xA;

    So NOW my text file looks like this :

    &#xA;&#xA;

    # this is a comment    &#xA;file &#x27;C:\Users\Joe\1May\session3\readyforfinalconversion\Titlefile.mp4&#x27;&#xA;file &#x27;C:\Users\Joe\1May\session3\readyforfinalconversion\Englishfile.mp4&#x27;&#xA;

    &#xA;