Advanced search

Medias (91)

Other articles (17)

  • Installation en mode ferme

    4 February 2011, by

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Emballe médias : à quoi cela sert?

    4 February 2011, by

    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 d’Apache

    4 February 2011, by

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

On other websites (3351)

  • Google Speech - Streaming Request Returns EOF

    9 October 2017, by Josh

    Using Go, I’m taking a RTMP stream, transcoding it to FLAC (using ffmpeg) and attempting to stream to Google’s Speech API to transcribe the audio. However, I keep getting EOF errors when sending the data. I can’t find any information on this error in the docs so I’m not exactly sure what’s causing it.

    I’m chunking the received data into 3s clips (length isn’t relevant as long as it’s less than the maximum length of a streaming recognition request).

    Here is the core of my code:

    func main() {

       done := make(chan os.Signal)
       received := make(chan []byte)

       go receive(received)
       go transcribe(received)

       signal.Notify(done, os.Interrupt, syscall.SIGTERM)

       select {
       case <-done:
           os.Exit(0)
       }
    }

    func receive(received chan<- []byte) {
       var b bytes.Buffer
       stdout := bufio.NewWriter(&b)

       cmd := exec.Command("ffmpeg", "-i", "rtmp://127.0.0.1:1935/live/key", "-f", "flac", "-ar", "16000", "-")
       cmd.Stdout = stdout

       if err := cmd.Start(); err != nil {
           log.Fatal(err)
       }

       duration, _ := time.ParseDuration("3s")
       ticker := time.NewTicker(duration)

       for {
           select {
           case <-ticker.C:
               stdout.Flush()
               log.Printf("Received %d bytes", b.Len())
               received <- b.Bytes()
               b.Reset()
           }
       }
    }

    func transcribe(received <-chan []byte) {
       ctx := context.TODO()

       client, err := speech.NewClient(ctx)
       if err != nil {
           log.Fatal(err)
       }

       stream, err := client.StreamingRecognize(ctx)
       if err != nil {
           log.Fatal(err)
       }

       // Send the initial configuration message.
       if err = stream.Send(&speechpb.StreamingRecognizeRequest{
           StreamingRequest: &speechpb.StreamingRecognizeRequest_StreamingConfig{
               StreamingConfig: &speechpb.StreamingRecognitionConfig{
                   Config: &speechpb.RecognitionConfig{
                       Encoding:        speechpb.RecognitionConfig_FLAC,
                       LanguageCode:    "en-GB",
                       SampleRateHertz: 16000,
                   },
               },
           },
       }); err != nil {
           log.Fatal(err)
       }

       for {
           select {
           case data := <-received:
               if len(data) > 0 {
                   log.Printf("Sending %d bytes", len(data))
                   if err := stream.Send(&speechpb.StreamingRecognizeRequest{
                       StreamingRequest: &speechpb.StreamingRecognizeRequest_AudioContent{
                           AudioContent: data,
                       },
                   }); err != nil {
                       log.Printf("Could not send audio: %v", err)
                   }
               }
           }
       }
    }

    Running this code gives this output:

    2017/10/09 16:05:00 Received 191704 bytes
    2017/10/09 16:05:00 Saving 191704 bytes
    2017/10/09 16:05:00 Sending 191704 bytes
    2017/10/09 16:05:00 Could not send audio: EOF

    2017/10/09 16:05:03 Received 193192 bytes
    2017/10/09 16:05:03 Saving 193192 bytes
    2017/10/09 16:05:03 Sending 193192 bytes
    2017/10/09 16:05:03 Could not send audio: EOF

    2017/10/09 16:05:06 Received 193188 bytes
    2017/10/09 16:05:06 Saving 193188 bytes
    2017/10/09 16:05:06 Sending 193188 bytes // Notice that this doesn't error

    2017/10/09 16:05:09 Received 191704 bytes
    2017/10/09 16:05:09 Saving 191704 bytes
    2017/10/09 16:05:09 Sending 191704 bytes
    2017/10/09 16:05:09 Could not send audio: EOF

    Notice that not all of the Sends fail.

    Could anyone point me in the right direction here? Is it something to do with the FLAC headers or something? I also wonder if maybe resetting the buffer causes some of the data to be dropped (i.e. it’s a non-trivial operation that actually takes some time to complete) and it doesn’t like this missing information?

    Any help would be really appreciated.

  • Ffmpeg: alternating audio languages in resulting movie for language learning

    20 November 2020, by almachuar
      

    1. Need to convert multiple-(audio)-language-video to single-audio-stream-video where 2 languages alternate repeatedly.
(10sec Lang2) + (15sec Lang3) + (10sec Lang2) + (15sec Lang3) + ... and so on till the end.
I assume it should be done with piping in and changing audio streams. (I've read ffmpeg piping documentation but didn't quite understand it).
    2. 


    


    I've done audio switching task (with scripting on Windows) by lively changing audio languages in video player but need better and crossplatform solution for little kid - preprepared video.

    


      

    1. If possible, to adjust loudness of one of the input audio streams to the other.
    2. 


    


    P.S. Think it would be useful for many married (programmers) to show little kids bilingual cartoons. (To prepare for language learning). By balancing 10/15 sec you may retain kid's attention — the older they grow the more native language they demand.

    


    Irrelevant, just for what's my experience:
    
%ffmpeg% -y -f concat -safe 0 -i %playlist% -i %picture% -map:v 0 -map:v 1 -c:v copy -disposition:v:0 attached_pic -ac 1 -af aresample=resampler=soxr -ar 16000 -%title% -%album% -%artist% %lyrics% -c:a aac -q:a 1 %output%

    


  • Extracting MP3 Data from Generic Movie Files using FFMPEG

    21 February 2017, by MoonKnight

    I am using FFMPEG via MediaToolkit to extract MP3 data (to .mp3 file) from different movie files (merely .mp4 and .mov for now).

    MediaToolkit is just a C# wrapper for FFMPEG which calls FFMPEG via Process.Start, so to do this I am using the method

    public static string GenerateMp3FromVideoFile(string filePath)
    {
       string mp3Path = String.Empty;
       using (var engine = new Engine())
       {
           mp3Path = Path.GetFileNameWithoutExtension(filePath);
           mp3Path = Path.Combine(Utils.GetBuildRoamingAppDataDirectory(), mp3Path);
           mp3Path = Path.ChangeExtension(mp3Path, ".mp3");
           string paramString = String.Format(
               //"-i \"{0}\" -q:a 0 -map a \"{1}\"",
               //"-i \"{0}\" -ar 320K \"{1}\"",
               //"-i \"{0}\" -acodec libmp3lame -ar 44100 -b:a 192k -id3v2_version 3 -write_id3v1 1 \"{1}\"",
               //"-i \"{0}\" -vn -ar 44100 -ac 2 -ab 192k -f mp3 \"{1}\"",
               "-i \"{0}\" -acodec libmp3lame \"{1}\"",
               filePath,
               mp3Path);
           engine.CustomCommand(paramString);
       }
       return mp3Path;
    }

    All of the options I have tried above for the command line arguments passed to FFMPEG have worked for .mp4 video files and create the desired .mp3 output. However, for the .mov file I have I am getting the following System.Exception

    69: video:0kB audio:1059kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.030074%Conversion failed!

    I have tried a number of different methods to perform this extraction with varing control via the arguments passed to FFMPEG, but with no luck for the .mov file.

    Looking at https://linuxconfig.org/ffmpeg-audio-format-conversions it seems as though there is not conversion to MP3 from .mov files, so I have looked at first converting the .mov to .mp4 via

    ffmpeg -i mymovie.mov -vcodec copy -acodec copy out.mp4

    and then extracting the audio, but this is expensive for large files. Is there a way of extracting the MP3 data directly from the .mov file?

    Thanks for your time.


    When the above command is run from FFMPEG.exe, the output is:

    [aac @ 00000000021b00a0] Inconsistent channel configuration.
    [aac @ 00000000021b00a0] get_buffer() failed
    Error while decoding stream #0:1: Invalid argument
    [aac @ 00000000021b00a0] Reserved bit set.
    [aac @ 00000000021b00a0] Number of bands (6) exceeds limit (5).
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] Number of bands (16) exceeds limit (13).
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] channel element 3.7 is not allocated
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] channel element 3.8 is not allocated
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] Reserved bit set.
    [aac @ 00000000021b00a0] TNS filter order 28 is greater than maximum 12.
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] Number of bands (26) exceeds limit (18).
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] Sample rate index in program config element does not match the sample rate index configured by
    the container.
    [aac @ 00000000021b00a0] Too large remapped id is not implemented. Update your FFmpeg version to the newest one from Git
    . If the problem still occurs, it means that your file has a feature which has not been implemented.
    [aac @ 00000000021b00a0] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and cont
    act the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
    Error while decoding stream #0:1: Not yet implemented in FFmpeg, patches welcome
    [aac @ 00000000021b00a0] Reserved bit set.
    [aac @ 00000000021b00a0] Prediction is not allowed in AAC-LC.
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] Reserved bit set.
    [aac @ 00000000021b00a0] ms_present = 3 is reserved.
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] Number of bands (3) exceeds limit (2).
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] SBR was found before the first channel element.
    [aac @ 00000000021b00a0] channel element 3.14 is not allocated
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 00000000021b00a0] Sample rate index in program config element does not match the sample rate index configured by
    the container.