Recherche avancée

Médias (1)

Mot : - Tags -/géodiversité

Autres articles (57)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    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" ;

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (3920)

  • ffmpeg and php upload

    3 décembre 2012, par Codded

    I have never used ffmpeg and was wondering if this script looked right and would work.

    I would like to convert the uploaded video to .flv and then add the filename to the hidden input

    <input type="&#39;hidden&#39;" value="&#39;&quot;.$txt.&quot;.flv&#39;" />

    But would also like to delete the original file after.

    Any help/comments would be greatly appreciated.

    if(isset($_POST) and $_SERVER[&#39;REQUEST_METHOD&#39;] == "POST")
    {
       $name = $_FILES[&#39;thisimage&#39;][&#39;name&#39;];
       $size = $_FILES[&#39;thisimage&#39;][&#39;size&#39;];

       if(strlen($name))
       {
           list($txt, $ext) = explode(".", $name);

           if(in_array($ext, $valid_formats_img))
           {
               if($size&lt;($image_size_limit*$image_size_limit))
               {
                   $actual_image_name = time().substr(str_replace(" ", "_", $txt), 5).".".$ext;
                   $tmp = $_FILES[&#39;thisimage&#39;][&#39;tmp_name&#39;];

                   if(move_uploaded_file($tmp, $path.$actual_image_name))
                   {
                       echo "<img src="http://stackoverflow.com/feeds/tag/&#39;media/&quot;.$actual_image_name.&quot;&#39;" class="&#39;showthumb&#39;" style='max-width: 300px; max-height: 300px' /><input type="&#39;hidden&#39;" value="&#39;0&#39;" /><input type="&#39;hidden&#39;" value="&#39;&quot;.$actual_image_name.&quot;&#39;" />";
                   }
                   else
                       echo &#39;<b style="color:#fff;">&#39;.$txt_img_err1.&#39;</b>&#39;;
               }
               else
                   echo &#39;<b style="color:#fff;">&#39;.$txt_img_up_size.&#39;</b>&#39;;
           }
           else if(in_array($ext, $valid_formats_vid))
           {
               if($size&lt;($videos_size_limit*$videos_size_limit))
               {
                   $actual_image_name = time().substr(str_replace(" ", "_", $txt), 5).".".$ext;
                   $tmp = $_FILES[&#39;thisimage&#39;][&#39;tmp_name&#39;];

                   if(move_uploaded_file($tmp, $path.$actual_image_name))
                   {

                   exec(&#39;ffmpeg -i &#39;$path.$actual_image_name.&#39; &#39;$path.$txt.&#39;.flv&#39;);    

                   ?>

                       
                       
                       
                       
                       
                       
                       
                   
                   <code class="echappe-js">&lt;script type=&quot;text/javascript&quot; src=&quot;http://stackoverflow.com/feeds/tag/jwplayer.js&quot;&gt;&lt;/script&gt;

    < ?php
    echo "" ;
    }
    else
    echo ''.$txt_img_err1.'' ;
    }
    else
    echo ''.$txt_img_up_size.'' ;
    }
    else
    echo ''.$txt_img_err2.'' ;
    }
    else
    echo ''.$txt_img_err3.'' ;

    exit ;
    }

  • How can I see the IP Camera on my phone

    11 janvier 2013, par Pike

    I try to use ffmpeg on android and want to see IP Camera
    but somethings wrong
    avformat_open_input(&gFormatCtx, "rtsp ://root:root@111.111.111.111/profile1/media.smp",NULL,NULL)
    av_open_input_file(&gFormatCtx,"rtsp ://root:root@111.111.111.111/profile1/media.smp", NULL, 0, NULL)

    two function can't return handle

    so add —enable-network —enable-protocol=tcp —enable-demuxer=rtsp —enable-decoder=h264 option

    then

    C:/Work/FFmpegBasic/obj/local/armeabi-v7a/libavformat.a(rtpdec.o): in function av_register_rtp_dynamic_payload_handlers:C:/Work/FFmpegBasic/jni/ffmpeg/libavformat/rtpdec.c:89: error: undefined reference to &#39;ff_g726_16_dynamic_handler&#39;
    C:/Work/FFmpegBasic/obj/local/armeabi-v7a/libavformat.a(rtpdec.o): in function av_register_rtp_dynamic_payload_handlers:C:/Work/FFmpegBasic/jni/ffmpeg/libavformat/rtpdec.c:89: error: undefined reference to &#39;ff_g726_24_dynamic_handler&#39;
    C:/Work/FFmpegBasic/obj/local/armeabi-v7a/libavformat.a(rtpdec.o): in function av_register_rtp_dynamic_payload_handlers:C:/Work/FFmpegBasic/jni/ffmpeg/libavformat/rtpdec.c:89: error: undefined reference to &#39;ff_g726_32_dynamic_handler&#39;
    C:/Work/FFmpegBasic/obj/local/armeabi-v7a/libavformat.a(rtpdec.o): in function av_register_rtp_dynamic_payload_handlers:C:/Work/FFmpegBasic/jni/ffmpeg/libavformat/rtpdec.c:89: error: undefined reference to &#39;ff_g726_40_dynamic_handler&#39;
    C:/Work/FFmpegBasic/obj/local/armeabi-v7a/libavcodec.a(allcodecs.o): in function avcodec_register_all:C:/Work/FFmpegBasic/jni/ffmpeg/libavcodec/allcodecs.c:346: error: undefined reference to &#39;ff_libaacplus_encoder&#39;
    C:/Work/FFmpegBasic/obj/local/armeabi-v7a/libavcodec.a(allcodecs.o): in function avcodec_register_all:C:/Work/FFmpegBasic/jni/ffmpeg/libavcodec/allcodecs.c:346: error: undefined reference to &#39;ff_libspeex_encoder&#39;
    collect2: ld returned 1 exit status
    /cygdrive/c/android-ndk-r8d/build/core/build-binary.mk:397: recipe for target `/cygdrive/c/Work/FFmpegBasic/obj/local/armeabi-v7a/libbasicplayer.so&#39; failed
    make: *** [/cygdrive/c/Work/FFmpegBasic/obj/local/armeabi-v7a/libbasicplayer.so] Error 1

    what's the problem ? ff ?
    how can I solve ?

  • Decoding an mp3 file using FFmpeg but sound is glitchy

    28 avril 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 play a simple mp3 file in Android without a success !
    The sound on my S4 working but it’s glitchy and stuttering
    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,
                    &amp;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;
    AVFormatContext* container=NULL;
       av_init_packet(&amp;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);
       }*/
    int lError;
            if ((lError = avformat_open_input(&amp;container, filename, NULL, NULL))
                    != 0) {
                LOGE("Error open source file: %d", lError);
                exit(1);
            }
            if ((lError =  avformat_find_stream_info(container,NULL)) &lt; 0) {
                LOGE("Error find stream information: %d", lError);
                exit(1);
            }
            LOGE("Stage 1.5");
           LOGE("audio format: %s", container->iformat->name);
          LOGE("audio bitrate: %llu", container->bit_rate);

       int stream_id = -1;
           // To find the first audio stream. This process may not be necessary
           // if you can gurarantee that the container contains only the desired
           // audio stream
              LOGE("nb_streams: %d", container->nb_streams);
           int i;
           for (i = 0; i &lt; container->nb_streams; i++) {
               if (container->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
                   stream_id = i;
                    LOGE("stream_id: %d", stream_id);
                   break;
               }
           }

           AVCodecContext* codec_context = container->streams[stream_id]->codec;
           codec = avcodec_find_decoder(codec_context->codec_id);
            LOGE("stream_id: %d", stream_id);
           LOGE("codec %s", codec->name);
           if (!codec) {
               fprintf(stderr, "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) &lt; 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);
       }



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

       while (1) {

       if ((len = av_read_frame(container, &amp;avpkt)) &lt; 0)
                          break;

           if (avpkt.stream_index == stream_id)
                        {
         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);
                                                }
                                            }
                               int got_frame = 0;
                                 len = avcodec_decode_audio4(c, decoded_frame, &amp;got_frame, &amp;avpkt);
                                LOGE("len=%d",len);
                                if (len &lt; 0)
                                {
                                    LOGE("Error decoding audio\n");
                                    continue;
                                }

                                if (got_frame)
                                {
                                     LOGE("begin frame decode\n");
                                     int data_size = av_samples_get_buffer_size(NULL, c->channels,decoded_frame->nb_samples,c->sample_fmt, 1);
                                   if (data_size>0)
                                   {
                                     LOGE("after frame decode %d\n",data_size);

                                    jbyte *bytes = (*env)->GetByteArrayElements(env, array, NULL);
                                     memcpy(bytes, decoded_frame->data[0], data_size);
                                     (*env)->ReleaseByteArrayElements(env, array, bytes, 0);
                                     (*env)->CallVoidMethod(env, obj, play, array, data_size);

                                    }
                                    else
                                    {
                                    fprintf(stderr, "Failed to calculate data size\n");
                                     exit(1);

                                    }

                                }

                                avpkt.size -= len;
                                avpkt.data += len;
                                avpkt.pts = AV_NOPTS_VALUE;
                               if (avpkt.size &lt; AUDIO_REFILL_THRESH)
                               {
                                   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(&amp;c);
    av_frame_free(&amp;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];


      audio_decode_example("/storage/emulated/0/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);


       }
    }

    Thank you so much for your help.
    Kind regards