Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (47)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Initialisation de MediaSPIP (préconfiguration)

    20 février 2010, par

    Lors de l’installation de MediaSPIP, celui-ci est préconfiguré pour les usages les plus fréquents.
    Cette préconfiguration est réalisée par un plugin activé par défaut et non désactivable appelé MediaSPIP Init.
    Ce plugin sert à préconfigurer de manière correcte chaque instance de MediaSPIP. Il doit donc être placé dans le dossier plugins-dist/ du site ou de la ferme pour être installé par défaut avant de pouvoir utiliser le site.
    Dans un premier temps il active ou désactive des options de SPIP qui ne le (...)

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

Sur d’autres sites (5302)

  • Simple FFMpeg player for Android

    23 janvier 2017, par don11995

    I have a problem with the output of AVFrame (AVPicture) into the ANativeWindow. I wrote simpe test code :

    void *Player::readThread(void * reserved) {
       ALOGD("Read thread started!");
       VideoState *state =  (VideoState *) reserved;

       int err = 0;
       int ret;
       int i;
       AVFormatContext *formatContext = NULL;
       AVCodecContext *codecContext = NULL;
       AVCodecParameters *codecParams = NULL;
       AVCodecID codecID = AV_CODEC_ID_NONE;
       AVCodec *decoder = NULL;
       AVFrame *frame = NULL;
       AVFrame *frameRGBA = NULL;
       AVPacket packet;
       struct SwsContext *img2RGBAContext;
       ANativeWindow_Buffer windowBuffer;
       uint8_t *RGBABuffer = NULL;
       int RGBABufferSize = 0;
       int got = 0;
       int windowWidth = 640;
       int windowHeight = 480;

       const char *url = state->url.c_str();
       if (url == NULL || strlen(url) <= 0) {
           err = ERROR_UNKNOWN_URI;
           goto exit;
       }
       ALOGD("URL to play: %s", url);

       state->isPlaying = true;

       formatContext = avformat_alloc_context();
       if (formatContext == NULL) {
           err = ERROR_OUT_OF_MEMORY;
           goto exit;
       }
       ALOGD("formatContext allocated");

       frame = av_frame_alloc();
       if (frame == NULL) {
           err = ERROR_OUT_OF_MEMORY;
           goto exit;
       }
       ALOGD("frame allocated");

       frameRGBA = av_frame_alloc();
       if (frameRGBA == NULL) {
           err = ERROR_OUT_OF_MEMORY;
           goto exit;
       }
       ALOGD("frameRGBA allocated");

       ret = avformat_open_input(&formatContext, url, NULL, NULL);
       if (ret != 0) {
           err = ERROR_CAN_NOT_OPEN_URI;
           goto exit;
       }
       ALOGD("formatContext opened");

       ret = avformat_find_stream_info(formatContext, NULL);
       if (ret != 0) {
           err = ERROR_CAN_NOT_FIND_STREAM_INFO;
           goto exit;
       }
       ALOGD("file info found");

       for (i = 0; i < formatContext->nb_streams; i++) {
           AVStream *stream = formatContext->streams[i];
           AVCodecParameters *codecParams = stream->codecpar;
           AVCodecID codecID = codecParams->codec_id;
           AVMediaType type = codecParams->codec_type;
           const char *codecName = avcodec_get_name(codecID);
           switch (type) {
               case AVMEDIA_TYPE_AUDIO:
                   ALOGD("Stream [%d]: type=AUDIO codecName=%s",i,codecName);
                   break;
               case AVMEDIA_TYPE_VIDEO:
                   ALOGD("Stream [%d]: type=VIDEO codecName=%s",i,codecName);
                   if (state->video_stream == -1) {
                       state->video_stream = i;
                   }
                   break;
               case AVMEDIA_TYPE_SUBTITLE:
                   ALOGD("Stream [%d]: type=SUBTITLE codecName=%s",i,codecName);
                   break;
               default:
                   ALOGD("Stream [%d]: type=UNKNOWN codecName=%s",i,codecName);
                   break;
           }
       }

       if (state->video_stream == -1) {
           err = ERROR_CAN_NOT_FIND_ANY_STREAM;
           goto exit;
       }
       ALOGD("Video stream index: %d",state->video_stream);

       codecParams = formatContext->streams[state->video_stream]->codecpar;
       codecID = codecParams->codec_id;
       if (codecID == AV_CODEC_ID_NONE) {
           err = ERROR_UNKNOWN_CODEC;
           goto exit;
       }
       ALOGD("Codec found");

       decoder = avcodec_find_decoder(codecID);
       if (decoder == NULL) {
           err = ERROR_CAN_NOT_FIND_DECODER;
           goto exit;
       }
       ALOGD("Decoder found");

       codecContext = avcodec_alloc_context3(decoder);
       if (codecContext == NULL) {
           err = ERROR_OUT_OF_MEMORY;
           goto exit;
       }
       ALOGD("codecContext created");

       ret = avcodec_parameters_to_context(codecContext, codecParams);
       if (ret < 0) {
           err = ERROR_CAN_NOT_START_DECODER;
           goto exit;
       }
       ALOGD("codecContext params was set");

       ret = avcodec_open2(codecContext, decoder, NULL);
       if (ret != 0) {
           err = ERROR_CAN_NOT_START_DECODER;
           goto exit;
       }
       ALOGD("Decoder opened");

       if (state->window != NULL) {
           ANativeWindow_setBuffersGeometry(state->window, codecParams->width, codecParams->height, WINDOW_FORMAT_RGB_565);
           ALOGD("Window geometry changed");
       }

       if (codecParams->width>0 && codecParams->height>0) {
           ALOGD("Video width: %d\nVideo height: %d",codecParams->width, codecParams->height);
           img2RGBAContext = sws_getCachedContext(
               NULL,
               codecParams->width,
               codecParams->height,
               (AVPixelFormat)codecParams->format,
               codecParams->width,
               codecParams->height,
               AV_PIX_FMT_RGB565,
               SWS_BICUBIC,
               NULL,
               NULL,
               NULL);
           if (img2RGBAContext == NULL) {
               err = ERROR_OUT_OF_MEMORY;
               goto exit;
           }
       } else {
           err = ERROR_CAN_NOT_START_DECODER;
           goto exit;
       }
       ALOGD("img2RGBAContext created");

       RGBABufferSize = av_image_get_buffer_size(AV_PIX_FMT_RGB565, codecParams->width, codecParams->height, 1);
       RGBABuffer = (uint8_t *)malloc(RGBABufferSize*sizeof(uint8_t));
       if (RGBABuffer == NULL) {
           err = ERROR_OUT_OF_MEMORY;
           goto exit;
       }
       ALOGD("frameRGBABuffer size %d bytes",RGBABufferSize);

       ret = av_image_alloc(frameRGBA->data, frameRGBA->linesize, codecParams->width, codecParams->height, AV_PIX_FMT_RGB565, 1);
       if (ret < 0) {
           err = ERROR_OUT_OF_MEMORY;
           goto exit;
       }

       while (av_read_frame(formatContext, &packet) >= 0 && state->isPlaying) {
           if (packet.stream_index != state->video_stream) {
               ALOGD("Packet is not a video packet. Discard.");
               av_packet_unref(&packet);
               continue;
           }
           ret = avcodec_send_packet(codecContext, &packet);
           if (ret != 0) {
               ALOGE("Can not send packet to decode");
               av_packet_unref(&packet);
               continue;
           }
           ret = avcodec_receive_frame(codecContext, frame);
           if (ret != 0) {
               ALOGE("Can not receive decoded frame yet");
               av_packet_unref(&packet);
               continue;
           }
           ALOGD("Converting image to RGB565...");
           sws_scale(img2RGBAContext, frame->data, frame->linesize, 0, codecParams->height, frameRGBA->data, frameRGBA->linesize);
           ALOGD("Image converted to RGB565");
           av_image_copy_to_buffer(RGBABuffer,
               RGBABufferSize,
               frameRGBA->data,
               frameRGBA->linesize,
               AV_PIX_FMT_RGB565,
               codecParams->width,
               codecParams->height,
               1);
           ALOGD("Image wrote into frameRGBABuffer");
           if (ANativeWindow_lock(state->window, &windowBuffer, NULL) == 0) {
               ALOGD("Writing %d bytes to windowBuffer", RGBABufferSize);
               memcpy(windowBuffer.bits, RGBABuffer, RGBABufferSize);
               ANativeWindow_unlockAndPost(state->window);
               ALOGD("Image displayed");
           } else {
               ALOGE("Can not display frame");
           }
           av_packet_unref(&packet);
       }

       exit:
       ALOGD("Releasing resources...");
       if (err!=0) {
           state->isPlaying = false;
           #if !LOG_NDEBUG
               switch (err) {
                   case  ERROR_OUT_OF_MEMORY:
                       ALOGE("Out of memory!");
                       break;
                   case  ERROR_CAN_NOT_OPEN_URI:
                       ALOGE("Can not open URI: %s", url);
                       break;
                   case  ERROR_UNKNOWN_URI:
                       ALOGE("Unknown URI to open!");
                       break;
                   default:
                       ALOGE("Unknown error");
                       break;
               }
           #endif
           // TODO: send error to listener
       }
       sws_freeContext(img2RGBAContext);
       free(RGBABuffer);
       av_free(frame);
       av_freep(&frameRGBA->data[0]);
       av_packet_unref(&packet);
       avcodec_close(codecContext);
       avformat_close_input(&formatContext);
       avformat_free_context(formatContext);
       ALOGD("Read thread closed!");
    }

    I faced with the next problem in some videos :
    enter image description here
    For example, this video gives me next logs :

    10-23 14:53:42.212 26970-4527/com.don.ffmpegplayer D/Player: Read thread started!
    10-23 14:53:42.212 26970-4527/com.don.ffmpegplayer D/Player: URL to play: http://www.ex.ua/load/280797285
    10-23 14:53:42.212 26970-4527/com.don.ffmpegplayer D/Player: formatContext allocated
    10-23 14:53:42.212 26970-4527/com.don.ffmpegplayer D/Player: frame allocated
    10-23 14:53:42.212 26970-4527/com.don.ffmpegplayer D/Player: frameRGBA allocated
    10-23 14:53:42.846 26970-4527/com.don.ffmpegplayer D/Player: formatContext opened
    10-23 14:53:42.879 26970-4527/com.don.ffmpegplayer D/Player: file info found
    10-23 14:53:42.879 26970-4527/com.don.ffmpegplayer D/Player: Stream [0]: type=VIDEO codecName=h264
    10-23 14:53:42.879 26970-4527/com.don.ffmpegplayer D/Player: Stream [1]: type=AUDIO codecName=ac3
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Stream [2]: type=AUDIO codecName=ac3
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Stream [3]: type=AUDIO codecName=ac3
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Stream [4]: type=SUBTITLE codecName=subrip
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Video stream index: 0
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Codec found
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Decoder found
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: codecContext created
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: codecContext params was set
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Decoder opened
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Window geometry changed
    10-23 14:53:42.880 26970-4527/com.don.ffmpegplayer D/Player: Video width: 1024
                                                                Video height: 424
    10-23 14:53:42.882 26970-4527/com.don.ffmpegplayer D/Player: img2RGBAContext created
    10-23 14:53:42.882 26970-4527/com.don.ffmpegplayer D/Player: frameRGBABuffer size 868352 bytes
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer E/Player: Can not receive decoded frame yet
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.889 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.890 26970-4527/com.don.ffmpegplayer D/Player: Packet is not a video packet. Discard.
    10-23 14:53:42.899 26970-4527/com.don.ffmpegplayer E/Player: Can not receive decoded frame yet
    10-23 14:53:42.905 26970-4527/com.don.ffmpegplayer D/Player: Converting image to RGB565...
    10-23 14:53:42.918 26970-4527/com.don.ffmpegplayer D/Player: Image converted to RGB565
    10-23 14:53:42.919 26970-4527/com.don.ffmpegplayer D/Player: Image wrote into frameRGBABuffer
    10-23 14:53:42.920 26970-4527/com.don.ffmpegplayer D/Player: Writing 868352 bytes to windowBuffer
    10-23 14:53:42.921 26970-4527/com.don.ffmpegplayer D/Player: Image displayed
    10-23 14:53:42.926 26970-4527/com.don.ffmpegplayer D/Player: Converting image to RGB565...
    10-23 14:53:42.934 26970-4527/com.don.ffmpegplayer D/Player: Image converted to RGB565
    10-23 14:53:42.935 26970-4527/com.don.ffmpegplayer D/Player: Image wrote into frameRGBABuffer
    10-23 14:53:42.936 26970-4527/com.don.ffmpegplayer D/Player: Writing 868352 bytes to windowBuffer
    10-23 14:53:42.937 26970-4527/com.don.ffmpegplayer D/Player: Image displayed

    What am I doing wrong ? If I understood correctly, I need to follow next steps :

    1. Get decoded AVFrame from decoder
    2. Convert AVFrame data to RGB565 or RGB8888
    3. Get pixel data from converted frame
    4. Write it to native window

    But in this code two points confuse me : is ANative_setBuffersGeometry called correctly and why frameRGBABuffer size is 868352 bytes ? If video size is 1024*424 frameRGBABuffer size must be width*height*4, isn’t it ? If I change frameRGBABuffer size to width*height*4 program carashes after first image diplayed. I pass video dimmensions to ANative_setBuffersGeometry.

    For any help thanks in anvance.

  • ffmpeg : mix audio and video of different length

    24 octobre 2016, par user3445678

    I have 2 files : 1 video file (without sound) - length 6 seconds, 1 audio - length 10 seconds.
    Both audio and video contains same conversation, but audio starts 4 seconds earlier and after that was started video.

    [----------] audio
       [------] video

    So, I want to mix them together to video file with length 10 seconds where first 4 seconds black screen with audio then goes real video and audio.

    [====------] audio+video (where '=' is black screen)

    I hope my description was clear enough ).
    How can I do this with ffmpeg or gstreamer ?

  • Building FFMPEG library for iOS5.1 ARMv7 Processor

    26 octobre 2012, par Jimmy

    I cleaned up my question a little bit, when I wrote it the first time I was flustered. Now I can be more clear after taking a small break.

    I'm trying to use the FFMPEG library in an XCode 4.5.1 project. And I'm trying to build it for ARMv7. What I'm looking for is the exact process, and some explanation. I understand that this is not a well documented problem. But I know that other pople have had the same problem as me.

    What I have been able to do.

    I have been able to build the library for xCode. here Is what I have been able to do step by step.

    1) I have been able to clone ffmpeg. For beginners this will get you started by creating a directory with the ffmpeg source. (Kudos to the guys who wrote it)

    git clone git ://source.ffmpeg.org/ffmpeg.git ffmpeg

    2) I have been able to write a config file that doesn't have any errors. We will go back to this part later. This is the command I attach to ./configure

    ./configure
    —disable-doc
    —disable-ffmpeg
    —disable-ffplay
    —disable-ffserver
    —enable-cross-compile
    —arch=arm
    —target-os=darwin
    —cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2

    —as='gas-preprocessor/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2'

    —sysroot=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk

    —cpu=cortex-a8
    —extra-ldflags='-arch=armv7 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk'
    —enable-pic —disable-bzlib —disable-gpl —disable-shared —enable-static —disable-mmx —disable-debug —disable-neon —extra-cflags='-pipe -Os -gdwarf-2 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
    -m$thumb_opt :-no-thumb -mthumb-interwork'

    These are some things to note.

    • I had to download ( https://github.com/yuvi/gas-preprocessor ) copy the file gas-preprocessor.pl at /usr/local/bin. Set permissions to read write (777)
    • Make sure I'm using the right GCC compiler : /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/arm-apple-darwin10-llvm-gcc-4.2
    • Make sure I'm using the right SDK : /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
    • —extra-cflags="-arch armv7" causes : error : unrecognized command line option “-arch”

    Here in lies the problem.

    When I include the library and the declaration. Everything works fine ! (You will want to make sure your library paths in xcode are properly written if it can't find the library. There are plenty of people with this problem, stackover flow has a wealth of knowledge here)

    But when I started to write the encoder. I received this warning, and countless errors.

    ignoring file /Users/Jimmy/Development/source.ffmpeg/Library/libavutil.a, file was built for archive which is not the architecture being linked (armv7s) : /Users/Jimmy/Development/source.ffmpeg/Library/libavutil.a

    That means that I didn't build for ARMv7 and that -arch configuration I took out is actually essential.

    What I'm looking for is someone whose done it before, to walk all of us through the process of building FFMPEG for iOS5.1 and ARMv7 and the majority of things to look out for. If no one comes forth, in time I'll answer my own question and hopefully help out others who are struggling too.