Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (111)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (9845)

  • How to convert a Stream on the fly with FFMpegCore ?

    18 octobre 2023, par Adrian

    For a school project, I need to stream videos that I get from torrents while they are downloading on the server.
When the video is a .mp4 file, there's no problem, but I must also be able to stream .mkv files, and for that I need to convert them into .mp4 before sending them to the client, and I can't find a way to convert my Stream that I get from MonoTorrents with FFMpegCore into a Stream that I can send to my client.

    


    Here is the code I wrote to simply download and stream my torrent :

    


    var cEngine = new ClientEngine();

var manager = await cEngine.AddStreamingAsync(GenerateMagnet(torrent), ) ?? throw new Exception("An error occurred while creating the torrent manager");

await manager.StartAsync();
await manager.WaitForMetadataAsync();

var videoFile = manager.Files.OrderByDescending(f => f.Length).FirstOrDefault();
if (videoFile == null)
    return Results.NotFound();

var stream = await manager.StreamProvider!.CreateStreamAsync(videoFile, true);
return Results.File(stream, contentType: "video/mp4", fileDownloadName: manager.Name, enableRangeProcessing: true);


    


    I saw that the most common way to convert videos is by using ffmpeg. .NET has a package called FFMpefCore that is a wrapper for ffmpeg.

    


    To my previous code, I would add right before the return :

    


    if (!videoFile.Path.EndsWith(".mp4"))
{
    var outputStream = new MemoryStream();
    FFMpegArguments
        .FromPipeInput(new StreamPipeSource(stream), options =>
        {
            options.ForceFormat("mp4");
        })
        .OutputToPipe(new StreamPipeSink(outputStream))
        .ProcessAsynchronously();
    return Results.File(outputStream, contentType: "video/mp4", fileDownloadName: manager.Name, enableRangeProcessing: true);
}


    


    I unfortunately can't get a "live" Stream to send to my client.

    


  • Does the Remote I/O audio unit set the number of channels in the buffer ?

    25 novembre 2013, par awfulcode

    I'm using kxmovie (it's a ffmpeg-based video player) as a base for an app and I'm trying to figure out how the RemoteI/O unit works on iOS when the only thing connected to a device is headphones and we're playing a track with more than 2 channels (say a surround 6 track channel). It seems like it is going with the output channel setting and the buffer only has 2 channels. Is this because of Core Audio's pull structure ? And if so, what's happening to the other channels in the track ? Are they being downmixed or simply ignored ?

    The code for the render callback connected to the remoteio unit is here :

    - (BOOL) renderFrames: (UInt32) numFrames
                  ioData: (AudioBufferList *) ioData
    {
       NSLog(@"Number of channels in buffer: %lu",ioData->mNumberBuffers);

       for (int iBuffer=0; iBuffer < ioData->mNumberBuffers; ++iBuffer) {
           memset(ioData->mBuffers[iBuffer].mData, 0, ioData->mBuffers[iBuffer].mDataByteSize);
       }


       if (_playing && _outputBlock ) {

           // Collect data to render from the callbacks
           _outputBlock(_outData, numFrames, _numOutputChannels);

           // Put the rendered data into the output buffer
           if (_numBytesPerSample == 4) // then we've already got floats
           {
               float zero = 0.0;

               for (int iBuffer=0; iBuffer < ioData->mNumberBuffers; ++iBuffer) {

                   int thisNumChannels = ioData->mBuffers[iBuffer].mNumberChannels;

                   for (int iChannel = 0; iChannel < thisNumChannels; ++iChannel) {
                       vDSP_vsadd(_outData+iChannel, _numOutputChannels, &zero, (float *)ioData->mBuffers[iBuffer].mData, thisNumChannels, numFrames);
                   }
               }
           }
           else if (_numBytesPerSample == 2) // then we need to convert SInt16 -> Float (and also scale)
           {
               float scale = (float)INT16_MAX;
               vDSP_vsmul(_outData, 1, &scale, _outData, 1, numFrames*_numOutputChannels);

               for (int iBuffer=0; iBuffer < ioData->mNumberBuffers; ++iBuffer) {

                   int thisNumChannels = ioData->mBuffers[iBuffer].mNumberChannels;

                   for (int iChannel = 0; iChannel < thisNumChannels; ++iChannel) {
                       vDSP_vfix16(_outData+iChannel, _numOutputChannels, (SInt16 *)ioData->mBuffers[iBuffer].mData+iChannel, thisNumChannels, numFrames);
                   }
               }

           }        
       }

       return noErr;
    }

    Thanks !

    edit : Here's the code for the ASBD (_ouputFormat). It's getting its values straight from the remoteio. You can also check the whole method file here.

    if (checkError(AudioUnitGetProperty(_audioUnit,
                                       kAudioUnitProperty_StreamFormat,
                                       kAudioUnitScope_Input,
                                       0,
                                       &_outputFormat,
                                       &size),
                  "Couldn't get the hardware output stream format"))
       return NO;


    _outputFormat.mSampleRate = _samplingRate;
    if (checkError(AudioUnitSetProperty(_audioUnit,
                                       kAudioUnitProperty_StreamFormat,
                                       kAudioUnitScope_Input,
                                       0,
                                       &_outputFormat,
                                       size),
                  "Couldn't set the hardware output stream format")) {

       // just warning
    }

    _numBytesPerSample = _outputFormat.mBitsPerChannel / 8;
    _numOutputChannels = _outputFormat.mChannelsPerFrame;

    NSLog(@"Current output bytes per sample: %ld", _numBytesPerSample);
    NSLog(@"Current output num channels: %ld", _numOutputChannels);

    // Slap a render callback on the unit
    AURenderCallbackStruct callbackStruct;
    callbackStruct.inputProc = renderCallback;
    callbackStruct.inputProcRefCon = (__bridge void *)(self);

    if (checkError(AudioUnitSetProperty(_audioUnit,
                                       kAudioUnitProperty_SetRenderCallback,
                                       kAudioUnitScope_Input,
                                       0,
                                       &callbackStruct,
                                       sizeof(callbackStruct)),
                  "Couldn't set the render callback on the audio unit"))
       return NO;
  • avformat/matroskadec : Check min_luminance more thoroughly

    16 février 2021, par Andreas Rheinhardt
    avformat/matroskadec : Check min_luminance more thoroughly
    

    In the absence of an explicitly coded minimal luminance, the current
    code inferred it to be -1, an invalid value. Yet it did not check the
    value lateron at all, so that if a valid maximum luminance is
    encountered, but no minimal luminance, an invalid minimal luminance of
    - 1 is exported. If an minimal luminance element with a negative value is
    present, it is exported, too. This can be simply fixed by adding a check
    for the value of the element.

    Yet given that a minimal luminance of zero Cd/m² is legal and can be
    coded with a length of zero, we must not use a fake default value to
    find out whether the element is present or not. Therefore this patch
    uses an explicit counter for it.

    While just at it, also check for max_luminance > min_luminance.

    Reviewed-by : Ridley Combs <rcombs@rcombs.me>
    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

    • [DH] libavformat/matroskadec.c