Recherche avancée

Médias (0)

Mot : - Tags -/navigation

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

Autres articles (40)

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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (7397)

  • Audio playing back at the wrong speed using FFmpeg on Android

    11 avril 2019, par Kyborg2011

    General problem in the following :
    I decode the audio as follows :

    ReSampleContext* rsc = av_audio_resample_init(
           1, aCodecCtx->channels,
           aCodecCtx->sample_rate, aCodecCtx->sample_rate,
           av_get_sample_fmt("u8"), aCodecCtx->sample_fmt,
           16, 10, 0, 1);

    while (av_read_frame(pFormatCtx, &packet)>= 0) {
       if (aCodecCtx->codec_type == AVMEDIA_TYPE_AUDIO) {
           int data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE * 2;
           int size=packet.size;
           int decoded = 0;

            while(size > 0) {
                int len = avcodec_decode_audio3(aCodecCtx, pAudioBuffer,
                    &data_size, &packet);

                //Сonvert audio to sample 8bit
                out_size = audio_resample(rsc, outBuffer, pAudioBuffer, len);

                jbyte *bytes = (*env)->GetByteArrayElements(env, array, NULL);

                memcpy(bytes, outBuffer, out_size);
                (*env)->ReleaseByteArrayElements(env, array, bytes, 0);
                (*env)->CallStaticVoidMethod(env, cls, mid, array, out_size, number);

                size -= len;
                number++;
            }
        }
    }

    Next release it AudioTrack. After that, I hear that song that was necessary, but with noise and speed of 2 times larger. In what may be the problem ?

    UPDATE :
    This is Java code :

    public static AudioTrack track;
    public static byte[] bytes;
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       int bufSize = 2048;
       track = new AudioTrack(AudioManager.STREAM_MUSIC, 44100, AudioFormat.CHANNEL_OUT_MONO,
                   AudioFormat.ENCODING_PCM_8BIT, bufSize, AudioTrack.MODE_STREAM);

       bytes = new byte[bufSize];
       Thread mAudioThread = new Thread(new Runnable() {
           public void run() {
               int res = main(2, "/sdcard/muzika_iz_reklami_bmw_5_series_-_bmw_5_series.mp3", bytes);
               System.out.println(res);
           }
       });
       mAudioThread.setPriority(Thread.MAX_PRIORITY);
       mAudioThread.start();
    }

    private static void play(byte[] play, int length, int p) {
       if (p==0){
           track.play();
       }
       track.write(play, 0, length);
    }
  • Ffmpeg hangs when -vcodec copy specified (called from Java via ProcessBuilder)

    24 juin 2015, par Inglonias

    I’m trying to use ffmpeg to export an array of bytes to a video file, but the people I work with insist that I use -vcodec copy in the arguments for it. This, however, causes the code to hang, whereas if I don’t use -vcodec copy, the code will not hang. I don’t know what the problem is, and I’ve been trying to debug this code for the past two hours.

    Here is the relevant section of code. I’ve added comments above and below the line where the code hangs. Can anybody help me ?

           // This is the tricky part. We need to build an ffmpeg process that
           // takes input from stdin, and then plug Java into that.
           ProcessBuilder ffmpegBuilder = new ProcessBuilder();
           String[] cmd = {"ffmpeg", "-i", "-","-vcodec", "copy", directory
                   + "/" + fileName};
           StringBuilder combinedCmd = new StringBuilder();
           for (String s : cmd) {
               combinedCmd.append(s);
               combinedCmd.append(" ");
           }
           mLogger.log(Level.INFO,"Final command is " + combinedCmd.toString());
           ffmpegBuilder.command(cmd);
           ffmpegBuilder.redirectErrorStream(true); // So that stdout and stderr go
                                                       // to the same stream.
           byte[] dataToWrite = new byte[data.size()];
           for (int i = 0; i < dataToWrite.length; i++) {
               dataToWrite[i] = data.get(i); // Is there really STILL no better way
                                               // to convert an ArrayList to an
                                               // array?!
           }
           try {
               Process ffmpeg = ffmpegBuilder.start();
               OutputStream stdin = ffmpeg.getOutputStream();
               BufferedReader stdout = new BufferedReader(new InputStreamReader(
                       ffmpeg.getInputStream()));
    //HANGS AT THIS LINE vvvvvvvvvvvvvvvv
               stdin.write(dataToWrite);
    //HANGS AT THIS LINE ^^^^^^^^^^^^^^^^

               String line = "I know a song that gets on everybody's nerves...";
               while ((line != null) && stdout.ready()) {
                   line = stdout.readLine();
                   mLogger.log(Level.INFO, line);
               }
               try {
                   ffmpeg.waitFor(2, TimeUnit.SECONDS);
                   ffmpeg.destroyForcibly();
               } catch (InterruptedException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
               }
           } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }
  • C# How do I set the volume of sound bytes[]

    23 juillet 2016, par McLucario

    Im trying to change the volume of sound bytes[] in C#. Im reading a sound file with FFMPEG and and wanna change the volume on the fly. I found some examples and but I didnt understand them.

    public void SendAudio(string pathOrUrl)
    {
       cancelVid = false;
       isPlaying = true;

       mProcess = Process.Start(new ProcessStartInfo
       { // FFmpeg requireqs us to spawn a process and hook into its stdout, so we will create a Process
           FileName = "ffmpeg",
           Arguments = "-i " + (char)34 + pathOrUrl + (char)34 + // Here we provide a list of arguments to feed into FFmpeg. -i means the location of the file/URL it will read from
           " -f s16le -ar 48000 -ac 2 pipe:1", // Next, we tell it to output 16-bit 48000Hz PCM, over 2 channels, to stdout.
           UseShellExecute = false,
           RedirectStandardOutput = true, // Capture the stdout of the process
           Verb = "runas"
       });

       while (!isRunning(mProcess)) { Task.Delay(1000); }

       int blockSize = 3840; // The size of bytes to read per frame; 1920 for mono
       byte[] buffer = new byte[blockSize];
       byte[] gainBuffer = new byte[blockSize];
       int byteCount;

       while (true && !cancelVid) // Loop forever, so data will always be read
       {
           byteCount = mProcess.StandardOutput.BaseStream // Access the underlying MemoryStream from the stdout of FFmpeg
           .Read(buffer, 0, blockSize); // Read stdout into the buffer

           if (byteCount == 0) // FFmpeg did not output anything
               break; // Break out of the while(true) loop, since there was nothing to read.

           if (cancelVid)
               break;

           disAudioClient.Send(buffer, 0, byteCount); // Send our data to Discord
       }
       disAudioClient.Wait(); // Wait for the Voice Client to finish sending data, as ffMPEG may have already finished buffering out a song, and it is unsafe to return now.
       isPlaying = false;
       Console.Clear();
       Console.WriteLine("Done Playing!");