Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (68)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

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

  • how to output a media stream using ffmpeg ?

    26 juin 2017, par Sanduni Wickramasinghe

    I am reading a mpeg4 video stream using ffmpeg. I use some of its properties and do some processes using those properties. What I want is to play the opened video using a player like vlc. And then consequently I need to play the output video after processing in order to check whether there is a latency. Is it possible to give the video to a port. So that I can get the video as a input to the vlc player from the specific port.

    This is my code up to now. I use MV_generation method to extract features from it and to do a comparison from it.

    static int MV_generation(const AVPacket *pkt)
    {
       std::vector<unsigned long="long"> vl = File_read();
       std::hash<string> hash1;
       std::ios_base::app);
       double x_src_val = 0;
       double y_src_val = 0;
       double x_dst_val = 0;
       double y_dst_val = 0;

       int ret = avcodec_send_packet(video_dec_ctx, pkt);
       if (ret &lt; 0) {
           //fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(ret));
           return ret;
       }
       video_frame_count++;
       while (ret >= 0){

           ret = avcodec_receive_frame(video_dec_ctx, frame);
           if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
               break;
           }
           else if (ret &lt; 0) {
               return ret;
           }
           if (ret >= 0) {
               AVFrameSideData *sd;
               sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);

               if (sd) {

                   const AVMotionVector *mvs = (const AVMotionVector *)sd->data;

                   int size_sd = sd->size;
                   //outData &lt;&lt; size_sd &lt;&lt; endl;

                   string str = "", str1, str2, str3, str4;
                   for (int i = 0; i &lt; size_sd / sizeof(*mvs); i++) {
                       const AVMotionVector *mv = &amp;mvs[i];

                       int x_src = mv->src_x;
                       int y_src = mv->src_y;
                       int x_dst = mv->dst_x;
                       int y_dst = mv->dst_y;


                       if (x_src != x_dst || y_src != y_dst || x_src > 100 || y_src > 100 || x_dst > 100 || y_dst > 100){
                           str1 = to_string(x_src);
                           str2 = to_string(y_src);
                           str3 = to_string(x_dst);
                           str4 = to_string(y_dst);

                           str = str.append(str1).append(str2).append(str3).append(str4);
                       }
                   }

                   for (unsigned long long y : vl)
                   {
                       // Check if any of the numbers are equal to x
                       if (hash1(str) == y)
                       {
                           cout &lt;&lt; "matched frame_no : " &lt;&lt; video_frame_count &lt;&lt; endl;
                       }
                   }
               }
               av_frame_unref(frame);
           }
       }
       outData.close();
       return 0;
    }
    </string></unsigned>
  • Record video with Media Recorder in WEBM format

    21 mai 2017, par Matho

    I need to record two videos via media recorder and process them with ffmpeg in Android. I want to read videos via pipe in ffmpeg command string. From what I have read, I could not use 3GPP/MP4 format, because these formats contains header at the end of video. Because of it, I want to use WEBM video format, but my app is crashing, when I use webm/vp8 setting in media recorder. Ffmpeg I’m using is : com.writingminds:FFmpegAndroid:0.3.2. Could you help me please ?

    RecorderPrepareTask :

    class RecorderPrepareTask extends AsyncTask {
    private Context mContext;

    public RecorderPrepareTask(Context context) {
       mContext = context;
    }

    @Override
    protected Boolean doInBackground(Void... voids) {
       Timber.d("Starting screen recording...");

       if (!outputRoot.exists() &amp;&amp; !outputRoot.mkdirs()) {
           Timber.e("Unable to create output directory '%s'.", outputRoot.getAbsolutePath());
           return false;
       }

       recorder = new MediaRecorder();
       recorder.setVideoSource(SURFACE);
       recorder.setOutputFormat(MediaRecorder.OutputFormat.WEBM);
       recorder.setVideoEncoder(MediaRecorder.VideoEncoder.VP8);
       recorder.setVideoSize(Config.VIDEO_SIZE_W, Config.VIDEO_SIZE_H);
       recorder.setVideoFrameRate(Config.FRAME_RATE);

       Timber.i("Output file '%s'.", outputFileName);
       recorder.setOutputFile(RecordingActivity.pipe[1].getFileDescriptor());


       try {
           recorder.prepare();
       } catch (IOException e) {
           throw new RuntimeException("Unable to prepare MediaRecorder.", e);
       }


       projection = projectionManager.getMediaProjection(resultCode, data);

       Surface surface = recorder.getSurface();
       display = projection.createVirtualDisplay(DISPLAY_NAME, Config.VIDEO_SIZE_W, Config.VIDEO_SIZE_H, 560, VIRTUAL_DISPLAY_FLAG_PRESENTATION, surface, null, null);

       recorder.start();

       return true;
    }

    @Override
    protected void onPostExecute(Boolean result) {

    }

    }

    getConvertCmd :

    private String getConvertCmd(){
       return "-re -r 30 -f webm -c:v vp8 -i pipe:"+ RecordingActivity.pipe[0].getFd() + " -threads 2 -preset ultrafast -profile:v main -level 3.1 -b:v 440k -ar 44100 -ab 128k -s "+ Config.CAMERA_VIDEO_SIZE_W + "x" + Config.CAMERA_VIDEO_SIZE_H + " -vcodec vp8 -acodec vorbis " + outputFileName3;
    }

    Logs :

    D/SoftVPXEncoder: VP8: internalSetAndroidVp8Params. BRMode: 0. TS: 0. KF: 24. QP: 0 - 0 BR0: 100. BR1: 0. BR2: 0
    I/ACodec: setupVideoEncoder succeeded
    E/OMXNodeInstance: setConfig(1a:google.vp8.encoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    I/ACodec: codec does not support config priority (err -2147483648)
    W/ACodec: do not know color format 0x7f000789 = 2130708361
    I/SoftMPEG4Encoder: Construct SoftMPEG4Encoder
    I/MediaCodec: MediaCodec will operate in async mode
    E/OMXNodeInstance: getParameter(1b:google.mpeg4.encoder, ParamVideoErrorCorrection(0x6000007)) ERROR: NotImplemented(0x80001006)
    I/ACodec: setupVideoEncoder succeeded
    E/OMXNodeInstance: setConfig(1b:google.mpeg4.encoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    I/ACodec: codec does not support config priority (err -2147483648)
    D/SoftVPXEncoder: VP8: initEncoder. BRMode: 0. TSLayers: 0. KF: 24. QP: 0 - 0
    I/AudioFlinger: AudioFlinger's thread 0xb2440000 ready to run
    xW/AudioFlinger: acquireAudioSessionId() unknown client 10079 for session 7
    I/MediaCodec: MediaCodec will operate in async mode
    /system_process I/DisplayManagerService: Display device added: DisplayDeviceInfo{"RMR": uniqueId="virtual:sk.matho.rocket_monkeys.rocketmonkeysrecorder,10052,RMR,0", 480 x 640, modeId 6, defaultModeId 6, supportedModes [{id=6, width=480, height=640, fps=60.0}], density 560, 560.0 x 560.0 dpi, appVsyncOff 0, presDeadline 16666666, touch NONE, rotation 0, type VIRTUAL, state ON, owner sk.matho.rocket_monkeys.rocketmonkeysrecorder (uid 10052), FLAG_PRIVATE, FLAG_PRESENTATION}
    E/OMXNodeInstance: setConfig(1c:google.amrnb.encoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    I/ACodec: codec does not support config priority (err -2147483648)
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x10003 imply creation of host color buffer
    I/MediaCodecSource: MediaCodecSource (video) starting
    I/MediaCodecSource: MediaCodecSource (video) started
    D/MPEG4Writer: Video track stopping
    E/MPEG4Writer: Stop() called but track is not started
    D/MPEG4Writer: Audio track stopping
    E/MPEG4Writer: Stop() called but track is not started

    [ 05-21 13:03:44.101  9757: 9766 D/         ]
    HostConnection::get() New Host Connection established 0xb344f140, tid 9766
    /sk.matho.rocket_monkeys.rocketmonkeysrecorder E/MediaRecorder: start failed: -2147483648                                                                                                  
    /sk.matho.rocket_monkeys.rocketmonkeysrecorder E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
    Process: sk.matho.rocket_monkeys.rocketmonkeysrecorder, PID: 10079
    java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:309)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)
    Caused by: java.lang.RuntimeException: start failed.
    at android.media.MediaRecorder.start(Native Method)
    at sk.matho.rocket_monkeys.rocketmonkeysrecorder.recording.CameraRecordingSession$MediaPrepareTask.doInBackground(CameraRecordingSession.java:181)
    at sk.matho.rocket_monkeys.rocketmonkeysrecorder.recording.CameraRecordingSession$MediaPrepareTask.doInBackground(CameraRecordingSession.java:173)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
    at java.lang.Thread.run(Thread.java:818) 

    [ 05-21 13:03:44.109  9757:10315 D/         ]
    HostConnection::get() New Host Connection established 0xb307c1c0, tid 10315
  • Record video with Media Recorder in WEBM format

    21 mai 2017, par Matho

    I need to record two videos via media recorder and process them with ffmpeg in Android. I want to read videos via pipe in ffmpeg command string. From what I have read, I could not use 3GPP/MP4 format, because these formats contains header at the end of video. Because of it, I want to use WEBM video format, but my app is crashing, when I use webm/vp8 setting in media recorder. Ffmpeg I’m using is : com.writingminds:FFmpegAndroid:0.3.2. Could you help me please ?

    RecorderPrepareTask :

    class RecorderPrepareTask extends AsyncTask {
    private Context mContext;

    public RecorderPrepareTask(Context context) {
       mContext = context;
    }

    @Override
    protected Boolean doInBackground(Void... voids) {
       Timber.d("Starting screen recording...");

       if (!outputRoot.exists() &amp;&amp; !outputRoot.mkdirs()) {
           Timber.e("Unable to create output directory '%s'.", outputRoot.getAbsolutePath());
           return false;
       }

       recorder = new MediaRecorder();
       recorder.setVideoSource(SURFACE);
       recorder.setOutputFormat(MediaRecorder.OutputFormat.WEBM);
       recorder.setVideoEncoder(MediaRecorder.VideoEncoder.VP8);
       recorder.setVideoSize(Config.VIDEO_SIZE_W, Config.VIDEO_SIZE_H);
       recorder.setVideoFrameRate(Config.FRAME_RATE);

       Timber.i("Output file '%s'.", outputFileName);
       recorder.setOutputFile(RecordingActivity.pipe[1].getFileDescriptor());


       try {
           recorder.prepare();
       } catch (IOException e) {
           throw new RuntimeException("Unable to prepare MediaRecorder.", e);
       }


       projection = projectionManager.getMediaProjection(resultCode, data);

       Surface surface = recorder.getSurface();
       display = projection.createVirtualDisplay(DISPLAY_NAME, Config.VIDEO_SIZE_W, Config.VIDEO_SIZE_H, 560, VIRTUAL_DISPLAY_FLAG_PRESENTATION, surface, null, null);

       recorder.start();

       return true;
    }

    @Override
    protected void onPostExecute(Boolean result) {

    }

    }

    getConvertCmd :

    private String getConvertCmd(){
       return "-re -r 30 -f webm -c:v vp8 -i pipe:"+ RecordingActivity.pipe[0].getFd() + " -threads 2 -preset ultrafast -profile:v main -level 3.1 -b:v 440k -ar 44100 -ab 128k -s "+ Config.CAMERA_VIDEO_SIZE_W + "x" + Config.CAMERA_VIDEO_SIZE_H + " -vcodec vp8 -acodec vorbis " + outputFileName3;
    }

    Logs :

    D/SoftVPXEncoder: VP8: internalSetAndroidVp8Params. BRMode: 0. TS: 0. KF: 24. QP: 0 - 0 BR0: 100. BR1: 0. BR2: 0
    I/ACodec: setupVideoEncoder succeeded
    E/OMXNodeInstance: setConfig(1a:google.vp8.encoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    I/ACodec: codec does not support config priority (err -2147483648)
    W/ACodec: do not know color format 0x7f000789 = 2130708361
    I/SoftMPEG4Encoder: Construct SoftMPEG4Encoder
    I/MediaCodec: MediaCodec will operate in async mode
    E/OMXNodeInstance: getParameter(1b:google.mpeg4.encoder, ParamVideoErrorCorrection(0x6000007)) ERROR: NotImplemented(0x80001006)
    I/ACodec: setupVideoEncoder succeeded
    E/OMXNodeInstance: setConfig(1b:google.mpeg4.encoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    I/ACodec: codec does not support config priority (err -2147483648)
    D/SoftVPXEncoder: VP8: initEncoder. BRMode: 0. TSLayers: 0. KF: 24. QP: 0 - 0
    I/AudioFlinger: AudioFlinger's thread 0xb2440000 ready to run
    xW/AudioFlinger: acquireAudioSessionId() unknown client 10079 for session 7
    I/MediaCodec: MediaCodec will operate in async mode
    /system_process I/DisplayManagerService: Display device added: DisplayDeviceInfo{"RMR": uniqueId="virtual:sk.matho.rocket_monkeys.rocketmonkeysrecorder,10052,RMR,0", 480 x 640, modeId 6, defaultModeId 6, supportedModes [{id=6, width=480, height=640, fps=60.0}], density 560, 560.0 x 560.0 dpi, appVsyncOff 0, presDeadline 16666666, touch NONE, rotation 0, type VIRTUAL, state ON, owner sk.matho.rocket_monkeys.rocketmonkeysrecorder (uid 10052), FLAG_PRIVATE, FLAG_PRESENTATION}
    E/OMXNodeInstance: setConfig(1c:google.amrnb.encoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
    I/ACodec: codec does not support config priority (err -2147483648)
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    E/WebmElement: mmap64 failed; errno = 22
    E/WebmElement: fd 18; flags: 1
    D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x10003 imply creation of host color buffer
    I/MediaCodecSource: MediaCodecSource (video) starting
    I/MediaCodecSource: MediaCodecSource (video) started
    D/MPEG4Writer: Video track stopping
    E/MPEG4Writer: Stop() called but track is not started
    D/MPEG4Writer: Audio track stopping
    E/MPEG4Writer: Stop() called but track is not started

    [ 05-21 13:03:44.101  9757: 9766 D/         ]
    HostConnection::get() New Host Connection established 0xb344f140, tid 9766
    /sk.matho.rocket_monkeys.rocketmonkeysrecorder E/MediaRecorder: start failed: -2147483648                                                                                                  
    /sk.matho.rocket_monkeys.rocketmonkeysrecorder E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
    Process: sk.matho.rocket_monkeys.rocketmonkeysrecorder, PID: 10079
    java.lang.RuntimeException: An error occurred while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:309)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)
    Caused by: java.lang.RuntimeException: start failed.
    at android.media.MediaRecorder.start(Native Method)
    at sk.matho.rocket_monkeys.rocketmonkeysrecorder.recording.CameraRecordingSession$MediaPrepareTask.doInBackground(CameraRecordingSession.java:181)
    at sk.matho.rocket_monkeys.rocketmonkeysrecorder.recording.CameraRecordingSession$MediaPrepareTask.doInBackground(CameraRecordingSession.java:173)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
    at java.lang.Thread.run(Thread.java:818) 

    [ 05-21 13:03:44.109  9757:10315 D/         ]
    HostConnection::get() New Host Connection established 0xb307c1c0, tid 10315