Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (94)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • 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

Sur d’autres sites (13612)

  • Construct ffmpeg command to do picture-in-picture for part of a video

    20 novembre 2015, par Arthur A. Gleckler

    I run a programming hobbyist users’ group, and I’ve started to video-record the talks given each time we meet. I’m trying to construct an ffmpeg command to take two video input streams, one a screen capture and the other of a speaker, and combine them into one video with picture-in-picture, taking the audio from the speaker video. I have basic picture-in-picture working in a simple ffmpeg command, but I want to be able to specify that the beginning and end of the video show just the speaker, while the middle is picture-in-picture with the speaker in the upper right-hand corner.

    Here’s what I have so far :

    ffmpeg \
     -ss 22 \
     -i "capture.mp4" \
     -ss 32 \
     -i "speaker.mov" \
     -filter_complex "[1] split=3[s1][s2][s3]; [s1] trim=0:10, scale=1920x1080 [prefix]; [s2] trim=10:, scale=iw/5:ih/5 [pip]; [s3] trim=0:0, scale=1920x1080 [suffix]; [0] copy [c]; [c][pip] overlay=main_w-overlay_w:0 [body]; [prefix][body][suffix] concat=n=3 [out]" \
     -map "[out]" \
     -profile:v baseline \
     -level 3.0 \
     -b:v 440k \
     -vcodec libx264 \
     -acodec copy \
     -y \
     ffmpeg-test.mov

    Right now, there are two problems :

    • no sound appears in the output

    • in the picture-in-picture section, the speaker’s motion isn’t smooth ; the video jumps as if he had been sampled every half second even though the speaker video is at 29.97 fps. (Perhaps the problem is that it’s matching the capture frame rate, which is 5 fps.)

    I’m trying to do this in just one command in order to make the processing as quick as possible.

    Is there any way to accomplish this with ffmpeg ? It would really help me to be able to automate this process as much as possible.

    Thanks.

    EDIT : Per LordNeckbeard’s request, here is the full console output :

    ffmpeg version 2.8.1 Copyright (c) 2000-2015 the FFmpeg developers
     built with Apple LLVM version 7.0.0 (clang-700.0.72)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.1_1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
     libavutil      54. 31.100 / 54. 31.100
     libavcodec     56. 60.100 / 56. 60.100
     libavformat    56. 40.101 / 56. 40.101
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 40.101 /  5. 40.101
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  2.101 /  1.  2.101
     libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'capture.mp4':
     Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2015-11-09 17:29:41
     Duration: 01:42:51.90, start: 0.000000, bitrate: 115 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 4 kb/s (default)
    Metadata:
     handler_name    : AAC stream handler
    Stream #0:1(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 109 kb/s, 5 fps, 5 tbr, 90k tbn, 180k tbc (default)
    Metadata:
     handler_name    : Citrix h264 stream handler
     encoder         : AVC Coding
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'speaker.mov':
     Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2015-11-09 21:17:52
     Duration: 00:59:57.60, start: 0.000000, bitrate: 7264 kb/s
    Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(bt709), 1440x1080 [SAR 4:3 DAR 16:9], 5724 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 59.94 tbc (default)
    Metadata:
     creation_time   : 2015-11-09 21:17:52
     handler_name    : Apple Alias Data Handler
     encoder         : AVCHD 1080i60
     timecode        : 00:00:00;00
    Stream #1:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
     creation_time   : 2015-11-09 21:17:52
     handler_name    : Apple Alias Data Handler
    Stream #1:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
     creation_time   : 2015-11-09 21:17:52
     handler_name    : Apple Alias Data Handler
     timecode        : 00:00:00;00
    [libx264 @ 0x7f99a980de00] using SAR=1/1
    [libx264 @ 0x7f99a980de00] frame MB size (120x68) > level limit (1620)
    [libx264 @ 0x7f99a980de00] DPB size (1 frames, 8160 mbs) > level limit (0 frames, 8100 mbs)
    [libx264 @ 0x7f99a980de00] MB rate (244555) > level limit (40500)
    [libx264 @ 0x7f99a980de00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0x7f99a980de00] profile Constrained Baseline, level 3.0
    [libx264 @ 0x7f99a980de00] 264 - core 148 r2601 a0cd7d3 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=440 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mov, to 'cli-ffmpeg-test.mov':
     Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    encoder         : Lavf56.40.101
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 440 kb/s, 29.97 fps, 11988 tbn, 29.97 tbc (default)
    Metadata:
     encoder         : Lavc56.60.100 libx264
    Stream mapping:
     Stream #0:1 (h264) -> copy
     Stream #1:0 (h264) -> split
     concat -> Stream #0:0 (libx264)
    Press [q] to stop, [?] for help
    frame=184483 fps=117 q=-1.0 Lsize=  256071kB time=01:42:35.58 bitrate= 340.8kbits/s dup=153456 drop=0    
    video:255343kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.285118%
    [libx264 @ 0x7f99a980de00] frame I:779   Avg QP: 5.70  size:181781
    [libx264 @ 0x7f99a980de00] frame P:183704 Avg QP:10.00  size:   652
    [libx264 @ 0x7f99a980de00] mb I  I16..4: 77.8%  0.0% 22.2%
    [libx264 @ 0x7f99a980de00] mb P  I16..4:  0.1%  0.0%  0.0%  P16..4:  0.4%  0.1%  0.1%  0.0%  0.0%    skip:99.3%
    [libx264 @ 0x7f99a980de00] final ratefactor: 13.35
    [libx264 @ 0x7f99a980de00] coded y,uvDC,uvAC intra: 21.1% 28.5% 19.4% inter: 0.2% 0.2% 0.1%
    [libx264 @ 0x7f99a980de00] i16 v,h,dc,p: 74% 23%  1%  2%
    [libx264 @ 0x7f99a980de00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 26% 15%  4%  4%  5%  4%  4%  5%
    [libx264 @ 0x7f99a980de00] i8c dc,h,v,p: 68% 20% 10%  1%
    [libx264 @ 0x7f99a980de00] kb/s:339.82

    Thanks again.

  • Xuggler decode H264 packets

    18 novembre 2015, par Roy Bean

    I’m making a test with xuggler, and I’m observing a behavior that I don’t understand.

    So I have a H264 frame, stored in a file and I want to decode it.
    Bassically I need of the IVideoPicture to then get a buffred image.

    for the same same packet I need of 10 tries until it retrieved that the IVideoPicture is complete.

    this is what ffmpeg does when reads the frame :

    Input #0, h264, from 'sample1.jpg':
    Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p, 352x288, 25 tbr, 1200k tbn, 50 tbc

    Can someone of xuggler or ffmpeg knowledge explain what is happen ?

    My code bellow :

    IContainer container = IContainer.make();

    RandomAccessFile aFile = new RandomAccessFile("c://sample1Frame/sample1.jpg","r");
    IContainerFormat format = IContainerFormat.make();
    format.setInputFormat("h264");
    container.open(aFile, IContainer.Type.READ, null);
    int numStreams = container.getNumStreams();


    IStreamCoder videoCoder = null;
    for(int i = 0; i < numStreams; i++)
    {
       IStream stream = container.getStream(i);
       // Get the pre-configured decoder that can decode this stream;
       IStreamCoder coder = stream.getStreamCoder();
       if(coder.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO)
       {
           System.out.println("coder");
       }
       videoCoder = coder;
    }

    // The timebase here is used as the camera frame rate    
    videoCoder.setTimeBase(IRational.make(25,1));

    // we need to tell the driver what video with and height to use
    videoCoder.setWidth(352);
    videoCoder.setHeight(288);

    if(videoCoder.open(null , null) < 0){
       System.err.println("Could not open video decoder for input container");
       return;
    }
    //      videoCoder.setFlag(IStreamCoder.Flags.FLAG_QSCALE,true);
    //      videoCoder.setFlag(IStreamCoder.Flags.FLAG2_FAST,true);

    IPacket packet = IPacket.make();
    //      long firstTimestampInStream = Global.NO_PTS;
    //      long systemClockStartTime = 0;
    int complete = 1;


    while(container.readNextPacket(packet) >= 0){
       int trys= 1;
       System.out.println("PCK = ");
       while(true)
       {
           trys++;
           System.out.println("trys = " + trys);
           System.out.println("packet " + packet.getSize());
           IVideoPicture picture = IVideoPicture.make(videoCoder.getPixelType(), videoCoder.getWidth(), videoCoder.getHeight());


           //TODO
           int offset = 0;
           while(offset < packet.getSize())
           {
               /*
                * Now, we decode the video, checking for any errors.
                *
                */
               System.out.println("packet getTimeBase " + packet.getTimeBase());
               System.out.println("vc getTimeBase " + videoCoder.getTimeBase());
               System.out.println("vc getCodecID " + videoCoder.getCodecID().toString());
               int bytOffset = videoCoder.decodeVideo(picture, packet, offset);
               Logger.getLogger(VideoSamsung.class.getName()).log(Level.SEVERE,"bytOffset =  " + bytOffset);

               if(bytOffset < 0){
                   //                  videoCoder.close();
                   //                  //                  picture.setComplete(true, com.xuggle.xuggler.IPixelFormat.Type.YUV420P, 352, 288, packet.getPts());
                   //                  System.err.println("picture.isComplete()"+picture.isComplete());
                   //                                      BufferedImage sdf = Utils.videoPictureToImage(picture);
                   //                                      File outputfile = new File("c://sdf/image.jpg");
                   //                                      ImageIO.write(sdf, "jpg", outputfile);
                   Logger.getLogger(VideoSamsung.class.getName()).log(Level.SEVERE,"BUMMMMMM!!!!!!!!!!!!!!!!!!!");
                   break;
               }else{
                   //System.out.println(DatatypeConverter.printBase64Binary(videoCoder.getExtraData().getByteArray(0, videoCoder.getExtraData().getSize())));
               }
               offset += bytOffset;
               System.err.println("picture.isComplete()"+picture.isComplete());

               /*
                * Some decoders will consume data in a packet, but will not be able to construct
                * a full video picture yet.  Therefore you should always check if you
                * got a complete picture from the decoder
                */

           }//end while(offset < packet.getSize())

           if (picture.isComplete())
           {
               System.out.println("isComplete");
               IVideoPicture newPic = picture;
               BufferedImage sdf = Utils.videoPictureToImage(picture);
               File outputfile = new File("c://sdf/image_"+complete+".jpg");
               ImageIO.write(sdf, "jpg", outputfile);
               complete++;
               System.out.println("trys = " + trys);
               break;
               //              System.exit(0);
           }else{
               System.out.println("Picture is not Complete");
           }

           if(trys > 20){
               System.out.println("FAIL!!!!!!!!!!  trys = " + trys);
               break;
           }
       }
    }
    /*
    * Technically since we're exiting anyway, these will be cleaned up by
    * the garbage collector... but because we're nice people and want
    * to be invited places for Christmas, we're going to show how to clean up.
    */
    if (videoCoder != null)
    {
       videoCoder.close();
       videoCoder = null;
    }
    if (container !=null)
    {
       container.close();
       container = null;
    }

    the console output :

       PCK =
    trys = 2
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    Picture is not Complete
    trys = 3
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    picture.isComplete()false
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    Picture is not Complete
    picture.isComplete()false
    trys = 4
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    picture.isComplete()false
    Picture is not Complete
    trys = 5
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    picture.isComplete()false
    Picture is not Complete
    trys = 6
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    picture.isComplete()false
    Picture is not Complete
    trys = 7
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    picture.isComplete()false
    Picture is not Complete
    trys = 8
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    picture.isComplete()false
    Picture is not Complete
    trys = 9
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    picture.isComplete()false
    Picture is not Complete
    trys = 10
    packet 1748
    packet getTimeBase 1/1200000
    vc getTimeBase 25/1
    vc getCodecID CODEC_ID_H264
    Nov 18, 2015 5:39:11 PM filepath main
    SEVERE: bytOffset =  1748
    picture.isComplete()true
    isComplete
    trys = 10
  • Error while trying to create dashcast stream using libx265

    16 décembre 2015, par Rahul

    I’m trying to create a h265 encoded stream from webcam using the follwoing command.

    DashCast -vf video4linux2  -v4l2f mjpeg -v /dev/video0 -conf dashcast.conf -live-media

    The content if dashcast.conf is

    [v1]
    type=video
    codec=libx265
    bitrate=1000000
    framerate=25
    width=640
    height=480

    But I’m getting this error.

    Options:
       video source: /dev/video0
       video format: video4linux2
       v4l2 format: mjpeg
       video crop: 0x0
       audio source:
    Configurations:
       id:v1   res:640x480 vbr:1000000
    [mjpeg @ 0xb194e0] Changeing bps to 8
    Input #0, video4linux2,v4l2, from '/dev/video0':
     Duration: N/A, start: 50349.327770, bitrate: N/A
       Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
    AVCTX give frame duration of 1/1000000 - keeping requested rate -1, but this may result in unexpected behaviour.
    [swscaler @ 0xb91ea0] deprecated pixel format used, make sure you did set range correctly
    Press q or Q to exit...
    [dashcast] Live system dropped a video frame
    [dashcast] Live system dropped a video frame
    x265 [info]: HEVC encoder version 1.85dcc9d3a928c400b
    x265 [info]: build info [Linux][GCC 4.8.4][64 bit] 8bit
    x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
    x265 [info]: Main profile, Level-3 (Main tier)
    x265 [info]: Thread pool created using 4 threads
    x265 [info]: frame threads / pool features       : 1 / wpp(8 rows)
    [dashcast] Live system dropped a video frame
    x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
    x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
    x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
    x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
    x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
    x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
    x265 [info]: References / ref-limit  cu / depth  : 3 / 0 / 0
    x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
    x265 [info]: Rate Control / qCompress            : ABR-1000 kbps / 0.60
    x265 [info]: tools: rd=3 psy-rd=0.30 signhide tmvp strong-intra-smoothing
    x265 [info]: tools: deblock sao
    Cannot parse HEVC/H265 SPS/PPS
    Bad Parameter: dc_gpac_video_write_config
    Bad Parameter: gf_isom_start_segment
    Cannot open output video file.
    Generating MPD at 2015-11-24T19:17:46.040Z
    StartTime: 2015-11-24T19:17:46.040Z - startNumber 1 - last number 1
    Keyboard thread exit
    [dashcast] Live system dropped a video frame
    [dashcast] Live system dropped a video frame

    What could be the problem ? Changing codec to libx264 in the conf file works fine.