Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

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

Autres articles (28)

  • L’utiliser, en parler, le critiquer

    10 avril 2011

    La première attitude à adopter est d’en parler, soit directement avec les personnes impliquées dans son développement, soit autour de vous pour convaincre de nouvelles personnes à l’utiliser.
    Plus la communauté sera nombreuse et plus les évolutions seront rapides ...
    Une liste de discussion est disponible pour tout échange entre utilisateurs.

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

Sur d’autres sites (3933)

  • Installing "ffmpeg" package from setup.py in Apache Beam pipeline running on Google Cloud Dataflow

    17 avril 2019, par John Allard

    I’m trying to run an Apache Beam pipeline on Google Cloud Dataflow that utilizes FFmpeg to perform transcoding operations. As I understand it, since ffmpeg is not a python package (available through PIP), I need to install it from setup.py using the following lines

    # The output of custom commands (including failures) will be logged in the
    # worker-startup log.
    CUSTOM_COMMANDS = [
       ['apt-get', 'update'],
       ['apt-get', 'install', '-y', 'ffmpeg']]

    Unfortunately, this is not working. My pipeline is stalling and when I go to examine the logs I’m seeing this

    enter image description here

    RuntimeError: Command ['apt-get', 'install', '-y', 'ffmpeg'] failed: exit code: 100

    It appears to be unable to find the package ’ffmpeg’. I’m curious as to why this is - ffmpeg is a standard package that should be available under apt-get.

  • Error decoding a simple audio file using FFmpeg library

    29 mars 2017, par satyres

    After successfuly compiling the latest version of FFmpeg library and generated .a library in Ubuntu I’ve been struggling now for more than a week to decode and play a simple mp3 file in Android without a success !
    I’ve followed this tutorial given by FFmpeg team in Github i’ve tried to use it in Android but no luck !
    here is the Native code.

    void Java_com_example_home_hellondk_MainActivity_audio_1decode_1example(JNIEnv * env, jobject obj, jstring file, jbyteArray array) {
       jboolean isfilenameCopy;
       const char * filename = ( * env) - > GetStringUTFChars(env, file, &
           isfilenameCopy);
       jclass cls = ( * env) - > GetObjectClass(env, obj);
       jmethodID play = ( * env) - > GetMethodID(env, cls, "playSound", "([BI)V");
       AVCodec * codec;
       AVCodecContext * c = NULL;
       int len;
       FILE * f, * outfile;
       uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
       AVPacket avpkt;
       AVFrame * decoded_frame = NULL;

       av_init_packet( & avpkt);

       printf("Decode audio file %s \n", filename);
       LOGE("Decode audio file %s\n", filename);
       /* find the MPEG audio decoder */
       codec = avcodec_find_decoder(AV_CODEC_ID_MP3);
       if (!codec) {
           fprintf(stderr, "Codec not found\n");
           LOGE("Codec not found\n");
           exit(1);
       }

       c = avcodec_alloc_context3(codec);
       if (!c) {
           fprintf(stderr, "Could not allocate audio codec context\n");
           LOGE("Could not allocate audio codec context\n");
           exit(1);
       }

       /* open it */
       if (avcodec_open2(c, codec, NULL) < 0) {
           fprintf(stderr, "Could not open codec\n");
           LOGE("Could not open codec\n");
           exit(1);
       }

       f = fopen(filename, "rb");
       if (!f) {
           fprintf(stderr, "Could not open %s\n", filename);
           LOGE("Could not open %s\n", filename);
           exit(1);
       }


       /* decode until eof */
       avpkt.data = inbuf;
       avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);

       while (avpkt.size > 0) {
           int i, ch;
           int got_frame = 0;

           if (!decoded_frame) {
               if (!(decoded_frame = av_frame_alloc())) {
                   fprintf(stderr, "Could not allocate audio frame\n");
                   LOGE("Could not allocate audio frame\n");
                   exit(1);
               }
           }

           len = avcodec_decode_audio4(c, decoded_frame, & got_frame, & avpkt);
           if (len < 0) {
               fprintf(stderr, "Error while decoding\n");
               LOGE("Error while decoding\n");
               exit(1);
           }
           if (got_frame) {
               /* if a frame has been decoded, output it */
               int data_size = av_get_bytes_per_sample(c - > sample_fmt);
               if (data_size < 0) {
                   /* This should not occur, checking just for paranoia */
                   fprintf(stderr, "Failed to calculate data size\n");
                   LOGE("Failed to calculate data size\n");
                   exit(1);
               }
               if (data_size > 0) {

                   jbyte * bytes = ( * env) - > GetByteArrayElements(env, array, NULL);
                   memcpy(bytes, decoded_frame, got_frame); //
                   ( * env) - > ReleaseByteArrayElements(env, array, bytes, 0);
                   ( * env) - > CallVoidMethod(env, obj, play, array, got_frame);
                   LOGE("DECODING ERROR5");
               }
           }
           avpkt.size -= len;
           avpkt.data += len;
           avpkt.dts =
               avpkt.pts = AV_NOPTS_VALUE;
           if (avpkt.size < AUDIO_REFILL_THRESH) {
               /* Refill the input buffer, to avoid trying to decode
                * incomplete frames. Instead of this, one could also use
                * a parser, or use a proper container format through
                * libavformat. */
               memmove(inbuf, avpkt.data, avpkt.size);
               avpkt.data = inbuf;
               len = fread(avpkt.data + avpkt.size, 1,
                   AUDIO_INBUF_SIZE - avpkt.size, f);
               if (len > 0)
                   avpkt.size += len;
           }
       }


       fclose(f);

       avcodec_free_context( & c);
       av_frame_free( & decoded_frame);

    }

    The Java code :

    package com.example.home.hellondk;

    import android.media.AudioFormat;
    import android.media.AudioManager;
    import android.media.AudioTrack;
    import android.media.MediaPlayer;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.util.Log;

    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;

    public class MainActivity extends AppCompatActivity {
       static {
           System.loadLibrary("MyLibraryPlayer");
       }
       public native void createEngine();

       public native void audio_decode_example(String outfilename, byte[] array);



       private AudioTrack track;
       private FileOutputStream os;

       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);
           createEngine();

    /*        MediaPlayer mp = new MediaPlayer();
           mp.start();*/

           int bufSize = AudioTrack.getMinBufferSize(32000,
                   AudioFormat.CHANNEL_CONFIGURATION_STEREO,
                   AudioFormat.ENCODING_PCM_16BIT);

           track = new AudioTrack(AudioManager.STREAM_MUSIC,
                   32000,
                   AudioFormat.CHANNEL_CONFIGURATION_STEREO,
                   AudioFormat.ENCODING_PCM_16BIT,
                   bufSize,
                   AudioTrack.MODE_STREAM);

           byte[] bytes = new byte[bufSize];

           try {
               os = new FileOutputStream("/storage/emulated/0/Cloud Radio/a.out", false);
           } catch (FileNotFoundException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }
      audio_decode_example("/storage/emulated/0/Cloud Radio/test.mp3", bytes);

       }

       void playSound(byte[] buf, int size) {
           //android.util.Log.v("ROHAUPT", "RAH Playing");
           if (track.getPlayState() != AudioTrack.PLAYSTATE_PLAYING)
               track.play();
           track.write(buf, 0, size);

           try {
               os.write(buf, 0, size);
           } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }
       }
    }

    I always got this error : Error while decoding .
    i’ve tried to change the decoder "AV_CODEC_ID_MP3" no sucess !
    Thank you so much for your help.
    Kind regards

  • simple program with ffmpeg isn`t writing file

    10 mars 2016, par Dmitry

    Here is the code i found on the Internet. I have tested it and foud out that packets are coming(and they are not empty and realy different) but it doestn`t write to file. Sending audio to my self via rtp with ffmpeg. How to fix it ?

    #include
    #define __STDC_CONSTANT_MACROS

    //Windows
    extern "C"
    {
    #include "libavformat/avformat.h"
    #include "libavutil/mathematics.h"
    #include "libavutil/time.h"
    };

    int main(int argc, char* argv[])
    {
        AVOutputFormat *ofmt = NULL;
        //Input AVFormatContext and Output AVFormatContext
        AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
        AVPacket pkt;
        const char *in_filename, *out_filename;
        int ret, i;
        int audioindex=-1;
        int frame_index=0;
        in_filename  = "rtp://36.11.8.88:10000";
        out_filename = "receive.wav";

        av_register_all();
        //Network
        avformat_network_init();
        //Input
        if ((ret = avformat_open_input(&ifmt_ctx, in_filename, 0, 0)) < 0) {
            printf( "Could not open input file.");
            goto end;
        }
        if ((ret = avformat_find_stream_info(ifmt_ctx, 0)) < 0) {
           printf( "Failed to retrieve input stream information");
           goto end;
        }
        for(i=0; inb_streams; i++)
           if(ifmt_ctx->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO){
               audioindex = i;
               break;
           }
        av_dump_format(ifmt_ctx, 0, in_filename, 0);
        //Output
        avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, out_filename); //RTMP

         if (!ofmt_ctx) {
            printf( "Could not create output context\n");
            ret = AVERROR_UNKNOWN;
            goto end;
        }
        ofmt = ofmt_ctx->oformat;
        for (i = 0; i < ifmt_ctx->nb_streams; i++) {
            //Create output AVStream according to input AVStream
            AVStream *in_stream = ifmt_ctx->streams[i];
            AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec);
            if (!out_stream) {
               printf( "Failed allocating output stream\n");
                ret = AVERROR_UNKNOWN;
                goto end;
            }
            //Copy the settings of AVCodecContext
            ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
            if (ret < 0) {
                printf( "Failed to copy context from input to output stream codec context\n");
                goto end;
            }
            out_stream->codec->codec_tag = 0;
            if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
           out_stream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
        }
        //Dump Format------------------
        av_dump_format(ofmt_ctx, 0, out_filename, 1);
        //Open output URL
        if (!(ofmt->flags & AVFMT_NOFILE)) {
            ret = avio_open2(&ofmt_ctx->pb, out_filename, AVIO_FLAG_WRITE);
            if (ret < 0) {
               printf( "Could not open output URL '%s'", out_filename);
                goto end;
            }
        }
        //Write file header
        ret = avformat_write_header(ofmt_ctx, NULL);
        if (ret < 0) {
            printf( "Error occurred when opening output URL\n");
            goto end;
        }
        while (1) {
            AVStream *in_stream, *out_stream;
            //Get an AVPacket
            ret = av_read_frame(ifmt_ctx, &pkt);
            if (ret < 0)
               break;

            in_stream  = ifmt_ctx->streams[pkt.stream_index];
            out_stream = ofmt_ctx->streams[pkt.stream_index];
            /* copy packet */
            //Convert PTS/DTS
            pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
            pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
            pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
            pkt.pos = -1;
            //Print to Screen
            if (pkt.stream_index == audioindex){
               printf("Receive %8d audio frames from input URL\n",frame_index);
                frame_index++;
            }
            ret = av_interleaved_write_frame(ofmt_ctx, &pkt);

            if (ret < 0) {
                printf( "Error muxing packet\n");
                break;
            }
            av_free_packet(&pkt);
        }
        //Write file trailer
        av_write_trailer(ofmt_ctx);
    end:
        avformat_close_input(&ifmt_ctx);
        /* close output */
        if (ofmt_ctx && !(ofmt->flags & AVFMT_NOFILE))
           avio_close(ofmt_ctx->pb);
        avformat_free_context(ofmt_ctx);
        if (ret < 0 && ret != AVERROR_EOF) {
            printf( "Error occurred.\n");
            return -1;
        }
        return 0;
    }