Recherche avancée

Médias (0)

Mot : - Tags -/alertes

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

Autres articles (98)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (5787)

  • ffmpeg reading from pipe to pipe doesn't work

    28 octobre 2022, par greg

    I'm trying to read audio data from one stream to other passing it through ffmpeg process.

    


    Process? CreateStream()
{
    return Process.Start(new ProcessStartInfo
    {
        FileName = @"sources\ffmpeg",
        Arguments = @"-hide_banner -i pipe:0 -f mp3 pipe:1",
        UseShellExecute = false,
        RedirectStandardInput = true,
        RedirectStandardOutput = true
    });
}


    


    For this i use OutputDataReceived event :

    


    private void Ffmpeg_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
    if (e.Data != null)
    {
        var bytes = Encoding.Unicode.GetBytes(e.Data);

        //writing data to another stream
    }
}


    


    But it falls at the end (even if i only getting data from input stream standart output without writing it it to output stream) with :

    


    


    Input #0, matroska,webm, from 'pipe:0' :
Metadata :
encoder : google/video-file
Duration : 00:03:13.12, start : -0.007000, bitrate : N/A
Stream #0:0(eng) : Audio : opus, 48000 Hz, stereo, fltp (default)
Stream mapping :
Stream #0:0 -> #0:0 (opus (native) -> mp3 (libmp3lame))
Output #0, mp3, to 'pipe:1' :
Metadata :
TSSE : Lavf59.27.100
Stream #0:0(eng) : Audio : mp3, 48000 Hz, stereo, fltp (default)
Metadata :
encoder : Lavc59.37.100 libmp3lame
size= 2969kB time=00:03:09.99 bitrate= 128.0kbits/s speed=47.5x

    


    


    


    av_interleaved_write_frame() : Invalid argument
Last message repeated 4 times

    


    


    


    Error writing trailer of pipe:1 : Invalid argument
size= 2997kB time=00:03:11.91 bitrate= 127.9kbits/s speed=47.4x
video:0kB audio:2999kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead : unknown

    


    


    


    Error closing file pipe:1 : Invalid argument
Conversion failed !

    


    


    It works well when i reading data from stream to file, what means that input data is valid :

    


    Arguments = @"-hide_banner -i pipe:0 -f mp3 output.mp3"


    


    main function code (it is the same for all examples) :

    


    async Task Do() 
{
    using (var ffmpeg = CreateStream())
    {
        if (ffmpeg == null) return;

        ffmpeg.OutputDataReceived += Ffmpeg_OutputDataReceived;

        using (var audioStream = GetInputStream())
        {
            ffmpeg.BeginOutputReadLine();
            await audioStream.CopyToAsync(ffmpeg.StandardInput.BaseStream);
            ffmpeg.StandardInput.Close();
        }
    }
}


    


  • streaming data with ffmpeg using pipe - freeze after few seconds

    13 octobre 2022, par tamirg

    Im fetching some video data, and trying to stream it using ffmpeg.
what i do is create an ffmpeg process, set it to get info from '-', and then when i fetch the video data i write it to the process STDIN.

    


    My problem is that its working, but only working for around 3 seconds, then the stream stops, and there are no longer any logs from ffmpeg.

    


    Im running ffmpeg with log level debug, and it seems to parse the data ok, which i guess thats why it works for 3 seconds, but then the ffmpeg stops printing any more logs.

    


    I dont want to attach all the logs because its too much, but ill write the main parts.
Maybe the ffmpeg process is missing some arguments ?

    


    It starts with :

    


    Clipping frame in rate conversion by 0.000008
2022-10-13T09:16:53.535546194Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2022-10-13T09:16:53.535987546Z     Last message repeated 2 times
2022-10-13T09:16:53.536012520Z [hevc @ 0x55f4e8798100] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.537017901Z [hevc @ 0x55f4e86eeb80] Decoded frame with POC 0.
2022-10-13T09:16:53.538652961Z [hevc @ 0x55f4e8798100] Output frame with POC 8.
2022-10-13T09:16:53.538782714Z [hevc @ 0x55f4e8789c00] Decoded frame with POC 1.
2022-10-13T09:16:53.540362322Z [hevc @ 0x55f4e8773500] Decoded frame with POC 2.
2022-10-13T09:16:53.540989229Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2022-10-13T09:16:53.541118680Z     Last message repeated 1 times
2022-10-13T09:16:53.541161109Z [hevc @ 0x55f4e86eeb80] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.542663730Z [hevc @ 0x55f4e86eeb80] Output frame with POC 9.
2022-10-13T09:16:53.544954074Z [hevc @ 0x55f4e8783e80] Decoded frame with POC 3.
2022-10-13T09:16:53.545102776Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2022-10-13T09:16:53.545165406Z     Last message repeated 2 times
2022-10-13T09:16:53.545175969Z [hevc @ 0x55f4e8789c00] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.546742754Z [hevc @ 0x55f4e8789c00] Output frame with POC 10.
2022-10-13T09:16:53.547695241Z [hevc @ 0x55f4e8877c40] Decoded frame with POC 4.
2022-10-13T09:16:53.549347290Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)


    


    then :

    


    2022-10-13T09:16:53.828180084Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)

2022-10-13T09:16:53.831843061Z     Last message repeated 2 times
2022-10-13T09:16:53.831902903Z [hevc @ 0x55f4e88984c0] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.831909160Z [hevc @ 0x55f4e88984c0] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.831912827Z [hevc @ 0x55f4e88984c0] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.832173968Z [hevc @ 0x55f4e88984c0] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.832309139Z [hevc @ 0x55f4e88984c0] Decoding VPS
2022-10-13T09:16:53.832324955Z [hevc @ 0x55f4e88984c0] Main profile bitstream
2022-10-13T09:16:53.832651015Z [hevc @ 0x55f4e88984c0] Decoding SPS
2022-10-13T09:16:53.832730623Z [hevc @ 0x55f4e88984c0] Main profile bitstream
2022-10-13T09:16:53.832785521Z [hevc @ 0x55f4e88984c0] Decoding VUI
2022-10-13T09:16:53.832833202Z [hevc @ 0x55f4e88984c0] Decoding PPS
2022-10-13T09:16:53.833112865Z [hevc @ 0x55f4e88984c0] Output frame with POC 0.
2022-10-13T09:16:53.835713007Z [hevc @ 0x55f4e8888080] Decoded frame with POC 59.
2022-10-13T09:16:53.836572581Z [libx264 @ 0x55f4e8794800] frame=   0 QP=44.23 NAL=3 Slice:I Poc:0   I:14400 P:0    SKIP:0    size=41597 bytes
2022-10-13T09:16:53.836783822Z [rtp @ 0x55f4eaa75fc0] Sending NAL 7 of len 24 M=0
2022-10-13T09:16:53.836805582Z [rtp @ 0x55f4eaa75fc0] Sending NAL 8 of len 4 M=0
2022-10-13T09:16:53.836809885Z [rtp @ 0x55f4eaa75fc0] Sending NAL 6 of len 642 M=0
2022-10-13T09:16:53.836830503Z [rtp @ 0x55f4eaa75fc0] Sending NAL 5 of len 40913 M=1
2022-10-13T09:16:53.836836082Z [rtp @ 0x55f4eaa75fc0] NAL size 40913 > 1460
2022-10-13T09:16:53.837084718Z [hevc @ 0x55f4e88a8900] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.837193504Z [hevc @ 0x55f4e88a8900] Output frame with POC 1.
2022-10-13T09:16:53.844457060Z [libx264 @ 0x55f4e8794800] frame=   1 QP=48.02 NAL=2 Slice:P Poc:2   I:16   P:655  SKIP:13729 size=1459 bytes
2022-10-13T09:16:53.844621824Z [rtp @ 0x55f4eaa75fc0] Sending NAL 1 of len 1455 M=1
2022-10-13T09:16:53.844680058Z [hevc @ 0x55f4e8798100] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:53.844749212Z [hevc @ 0x55f4e8798100] Output frame with POC 2.
2022-10-13T09:16:53.851913353Z [libx264 @ 0x55f4e8794800] frame=   2 QP=44.00 NAL=2 Slice:P Poc:4   I:0    P:11   SKIP:14389 size=48 bytes


    


    and finally the last logs are those, and afterwards i don't get anymore logs :

    


    2022-10-13T09:16:56.836957083Z [NULL @ 0x55f4e86e7a00] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:56.837158270Z [hevc @ 0x55f4e8773500] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0
2022-10-13T09:16:56.837355973Z [hevc @ 0x55f4e8773500] Output frame with POC 59.
2022-10-13T09:16:56.837935475Z [hevc @ 0x55f4e86eeb80] Decoded frame with POC 57.
2022-10-13T09:16:56.840799210Z [hevc @ 0x55f4e8789c00] Decoded frame with POC 58.
2022-10-13T09:16:56.842434529Z [libx264 @ 0x55f4e8794800] frame=  59 QP=33.00 NAL=2 Slice:P Poc:118 I:11   P:952  SKIP:13437 size=5251 bytes
2022-10-13T09:16:56.842472226Z [rtp @ 0x55f4eaa75fc0] Sending NAL 1 of len 5247 M=1
2022-10-13T09:16:56.842478464Z [rtp @ 0x55f4eaa75fc0] NAL size 5247 > 1460
2022-10-13T09:16:56.846625001Z [hevc @ 0x55f4e8773500] Decoded frame with POC 59.


    


  • ffmpeg : "Input/output error" Read gif from named pipe ?

    23 octobre 2022, par Xirado

    I've been trying to debug this for hours now, and cannot seem to understand why it doesn't work.

    


    I want to overlay a png onto all frames of a gif, and since writing all the files to disk is slow, i wanted to use pipes.

    


    I created a named pipe using mkfifo imgstream1 and then launch ffmpeg :

    


    ffmpeg -report -hide_banner -v 9 -loglevel 99 -y -f gif -i imgstream1 out1.gif


    


    (This isn't actually useful as it just spits out the same gif again but it's simpler for debugging)

    


    After ffmpeg launches it waits for data from the pipe, so i write an actual gif file to the pipe using this kotlin code

    


    val backgroundFifo = File("imgstream1")
val inputOne = File("background.gif").readBytes()
println("background.gif -> ${inputOne.size} bytes")
val output = backgroundFifo.outputStream()
output.write(inputOne)
output.flush()
output.close()


    


    It prints : background.gif -> 7233247 bytes

    


    Now ffmpeg should read the bytes and spit out a gif, but it always seems to fail doing so.

    


    Opening an input file: imgstream1.
[gif @ 0x7714180] Opening 'imgstream1' for reading
[file @ 0x7714980] Setting default whitelist 'file,crypto,data'
[AVIOContext @ 0x7724dc0] Statistics: 7233247 bytes read, 0 seeks
imgstream1: Input/output error


    


    Sadly this does not give any further information, i'm already on the highest log level...

    


    I've tried multiple things :

    


      

    • -f image2pipe -> Works, but only loads the first 2 frames of the gif
    • 


    • Renaming the pipe to imgstream1.gif so ffmpeg thinks it's a gif file, no change.
    • 


    • Different ffmpeg versions
    • 


    • Using the actual gif as an ffmpeg input works
    • 


    


    At this point i have no idea what the problem might be, as ffmpeg seems to load all bytes.
It's worth noting that doing cat imgstream1 > file.gif produces the desired gif.

    


    Any help would be appreciated !