Recherche avancée

Médias (91)

Autres articles (27)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (3863)

  • Extract audio from video using autogen ffmpeg C# in Unity

    5 décembre 2024, par Johan Sophie

    Hi I'm using ffmpeg autogen to extract audio from video in Unity, but when I following this code, the file write cannot write, it's 0Kb, so what's issue of this or someone have any examples for extract audio using this library, apologize for my English. This is github of library : 
https://github.com/Ruslan-B/FFmpeg.AutoGen

    



    unsafe void TestExtractAudio()
{

    string inFile = Application.streamingAssetsPath + "/" + strFileName;
    string outFile = Application.streamingAssetsPath + "/" + strFileNameAudio;

    AVOutputFormat* outFormat = null;
    AVFormatContext* inFormatContext = null;
    AVFormatContext* outFormatContext = null;
    AVPacket packet;

    ffmpeg.av_register_all();

    inFormatContext = ffmpeg.avformat_alloc_context();
    outFormatContext = ffmpeg.avformat_alloc_context();

    if (ffmpeg.avformat_open_input(&inFormatContext, inFile, null, null) < 0)
    {
        throw new ApplicationException("Could not open input file.");
    }

    if (ffmpeg.avformat_find_stream_info(inFormatContext, null) < 0)
    {
        throw new ApplicationException("Failed to retrieve input stream info.");
    }

    ffmpeg.avformat_alloc_output_context2(&outFormatContext, null, null, outFile);
    if (outFormatContext == null)
    {
        throw new ApplicationException("Could not create output context");
    }

    outFormat = outFormatContext->oformat;

    AVStream* inStream = inFormatContext->streams[1];
    AVStream* outStream = ffmpeg.avformat_new_stream(outFormatContext, inStream->codec->codec);
    if (outStream == null)
    {
        throw new ApplicationException("Failed to allocate output stream.");
    }

    if (ffmpeg.avcodec_copy_context(outStream->codec, inStream->codec) < 0)
    {
        throw new ApplicationException("Couldn't copy input stream codec context to output stream codec context");
    }

    outFormatContext->audio_codec_id = AVCodecID.AV_CODEC_ID_MP3;

    int retcode = ffmpeg.avio_open(&outFormatContext->pb, outFile, ffmpeg.AVIO_FLAG_WRITE);
    if (retcode < 0)
    {
        throw new ApplicationException("Couldn't open output file");
    }

    int returnCode = ffmpeg.avformat_write_header(outFormatContext, null);

    if (returnCode < 0)
    {
        throw new ApplicationException("Error occurred opening output file.");
    }

    while (true)
    {
        if (ffmpeg.av_read_frame(inFormatContext, &packet) < 0)
        {
            break;
        }

        if (packet.stream_index == 1)
        {

            inStream = inFormatContext->streams[1];
            outStream = outFormatContext->streams[0];

            // TODO: Replicate log packet functionality to print out what's inside the packet.

            packet.pts = ffmpeg.av_rescale_q_rnd(packet.pts, inStream->time_base, outStream->time_base,
                AVRounding.AV_ROUND_NEAR_INF | AVRounding.AV_ROUND_PASS_MINMAX);
            packet.dts = ffmpeg.av_rescale_q_rnd(packet.dts, inStream->time_base, outStream->time_base,
                AVRounding.AV_ROUND_NEAR_INF | AVRounding.AV_ROUND_PASS_MINMAX);

            packet.duration = ffmpeg.av_rescale_q(packet.duration, inStream->time_base, outStream->time_base);

            int returncode = ffmpeg.av_interleaved_write_frame(outFormatContext, &packet);

        }

        ffmpeg.av_packet_unref(&packet);
    }

    ffmpeg.av_write_trailer(outFormatContext);


    ffmpeg.avformat_close_input(&inFormatContext);

    ffmpeg.avformat_free_context(outFormatContext);

    Console.WriteLine("Press any key to continue...");

    Console.ReadKey();
}


    



    the value returnCode return less than 0, so someone can fix this, thanks so much for that

    


  • How to embed subtitles into an mp4 file using gstreamer

    27 août 2021, par Stephen

    My Goal

    


    I'm trying to embed subtitles into an mp4 file using the mp4mux gstreamer element.

    


    What I've tried

    


    The pipeline I would like to use is :

    


    GST_DEBUG=3 gst-launch-1.0 filesrc location=sample-nosub-avc.mp4 ! qtdemux ! queue ! video/x-h264 ! mp4mux name=mux reserved-moov-update-period=1000 ! filesink location=output.mp4 filesrc location=english.srt ! subparse ! queue ! text/x-raw,format=utf8 ! mux.subtitle_0


    


    It just demuxes a sample mp4 file for the h.264 stream and then muxes it together with an srt subtitle file.

    


    The error I get is :

    


    Setting pipeline to PAUSED ...&#xA;0:00:00.009958915 1324869 0x5624a8c7a0a0 WARN                 basesrc gstbasesrc.c:3600:gst_base_src_start_complete:<filesrc0> pad not activated yet&#xA;Pipeline is PREROLLING ...&#xA;0:00:00.010128080 1324869 0x5624a8c53de0 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<filesrc1> error: Internal data stream error.&#xA;0:00:00.010129102 1324869 0x5624a8c53e40 WARN                 qtdemux qtdemux_types.c:239:qtdemux_type_get: unknown QuickTime node type pasp&#xA;0:00:00.010140810 1324869 0x5624a8c53de0 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<filesrc1> error: streaming stopped, reason not-negotiated (-4)&#xA;0:00:00.010172990 1324869 0x5624a8c53e40 WARN                 qtdemux qtdemux.c:3237:qtdemux_parse_trex:<qtdemux0> failed to find fragment defaults for stream 1&#xA;ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc1: Internal data stream error.&#xA;Additional debug info:&#xA;gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc1:&#xA;streaming stopped, reason not-negotiated (-4)&#xA;ERROR: pipeline doesn&#x27;t want to preroll.&#xA;Setting pipeline to NULL ...&#xA;Freeing pipeline ...&#xA;</qtdemux0></filesrc1></filesrc1></filesrc0>

    &#xA;

    My Thoughts

    &#xA;

    I believe the issue is not related to the above warning but rather mp4mux's incompatibility with srt subtitles.

    &#xA;

    The reason I belive this is because, other debug logs hint at it, but also stealing the subititles from another mp4 file and muxing it back together does work.

    &#xA;

    gst-launch-1.0  filesrc location=sample-nosub-avc.mp4 ! qtdemux ! mp4mux name=mux ! filesink location=output.mp4 filesrc location=sample-with-subs.mp4 ! qtdemux name=demux demux.subtitle_1 ! text/x-raw,format=utf8 ! queue ! mux.subtitle_0&#xA;

    &#xA;

    A major catch 22 I am having is that mp4 files don't typically support srt subtitles, but gstreamer's subparse element doesn't support parsing mp4 subtitle formats (tx3g, ttxt, etc.) so I'm not sure how I'm meant to put it all together.

    &#xA;

    I'm very sorry for the lengthy question but I've tried many things so it was difficult to condense it. Any hints or help is appreciated. Thank you.

    &#xA;

  • How to encode multi audio streams with different options at the same time using ffmpeg

    20 mars 2012, par Luca Borrione

    I'm trying to encode a dvd using ffmpeg.

    $ffmpeg -i VTS_01_1.VOB
    Input #0, mpeg, from &#39;VTS_01_1.VOB&#39;:
    Duration: 00:38:06.52, start: 0.287267, bitrate: 3756 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 9800 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
    Stream #0:2[0x81]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
    Stream #0:3[0x82]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
    Stream #0:4[0x83]: Audio: ac3, 48000 Hz, mono, s16, 96 kb/s
    Stream #0:5[0x28]: Subtitle: dvd_subtitle
    Stream #0:6[0x29]: Subtitle: dvd_subtitle
    Stream #0:7[0x23]: Subtitle: dvd_subtitle
    Stream #0:8[0x24]: Subtitle: dvd_subtitle
    Stream #0:9[0x26]: Subtitle: dvd_subtitle
    Stream #0:10[0x27]: Subtitle: dvd_subtitle

    From the above streams I'm interested in keeping two audio streams : number 1 and 4.
    As you can see the number 4 is already 96kbps so I tried to execute a command which could treat the two streams in a different way :

    cat VTS_01_1.VOB | nice ffmpeg -i - -s 640x368 -vcodec libtheora -r 25 -b:v 1200k -an -metadata title="My Title" -pass 1 -passlogfile "/media/data/outputlog" -f ogg -y /dev/null

    cat VTS_01_1.VOB | nice ffmpeg -i - -map 0:0 -s 640x368 -vcodec libtheora -r 25 -b:v 1200k -async 1 -metadata title="My Title" -map 0:1 -acodec libvorbis -ac 6 -ar 48000 -b:a 192k -metadata title="english" -map 0:4 -acodec libvorbis -ac 2 -ar 48000 -b:a 96k -metadata title="commented" -pass 2 -passlogfile "/media/data/outputlog" "/media/data/output.ogv"

    What I would like to obtain is :

    Input #0, ogg, from &#39;output.ogv&#39;:
    Duration: 00:38:07.20, start: 0.000000, bitrate: 1360 kb/s
    Stream #0:0: Video: theora, yuv420p, 640x368 [SAR 46:45 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: vorbis, 48000 Hz, stereo, s16, 192 kb/s
    Stream #0:2: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s

    Instead with the above command I obtain :

    Input #0, ogg, from &#39;output.ogv&#39;:
    Duration: 00:38:07.20, start: 0.000000, bitrate: 1360 kb/s
    Stream #0:0: Video: theora, yuv420p, 640x368 [SAR 46:45 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s
    Stream #0:2: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s

    So how can I specify different params for multiple audio streams ?

    BTW : I'm on lubuntu oneiric with the latest ffmpeg from git

    ffmpeg version git-2012-03-05-1007a80 Copyright (c) 2000-2012 the FFmpeg developers
    built on Mar  5 2012 09:40:09 with gcc 4.6.1
    configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab --enable-libxvid --enable-libvpx
    libavutil      51. 41.100 / 51. 41.100
    libavcodec     54.  8.100 / 54.  8.100
    libavformat    54.  2.100 / 54.  2.100
    libavdevice    53.  4.100 / 53.  4.100
    libavfilter     2. 63.100 /  2. 63.100
    libswscale      2.  1.100 /  2.  1.100
    libswresample   0.  7.100 /  0.  7.100
    libpostproc    52.  0.100 / 52.  0.100

    Therefore the newaudio option is no more recognized