Recherche avancée

Médias (91)

Autres articles (84)

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (16268)

  • How to catch stdout stream in ffmpeg then pipe it to v4l2loopback

    29 août 2015, par Tveitan

    I’m trying to pipe my h264 stream to ffmpeg and then to my v4l2loopback device. Problem is that I’m fairly new to linux, so just can’t get it working.
    The stream can be outputted to stdout, but I do not know how to catch it again with ffmpeg and then again pipe it to my v4l2loopback device.

    Does anybody know how this could be done or maybe a pointer on how to solve it ?

    This is the capture program :

    PS ! You can find the options for the capture program almost in the bottom of the code.

    /*
    *  V4L2 video capture example, modified by Derek Molloy for the Logitech C920 camera
    *  Modifications, added the -F mode for H264 capture and associated help detail
    *  www.derekmolloy.ie
    *
    *  V4L2 video capture example
    *
    *  This program can be used and distributed without restrictions.
    *
    *      This program is provided with the V4L2 API
    * see http://linuxtv.org/docs.php for more information
    */

    #include
    #include
    #include
    #include

    #include              /* getopt_long() */

    #include               /* low-level i/o */
    #include
    #include
    #include <sys></sys>stat.h>
    #include <sys></sys>types.h>
    #include <sys></sys>time.h>
    #include <sys></sys>mman.h>
    #include <sys></sys>ioctl.h>

    #include <linux></linux>videodev2.h>

    #define CLEAR(x) memset(&amp;(x), 0, sizeof(x))

    enum io_method {
           IO_METHOD_READ,
           IO_METHOD_MMAP,
           IO_METHOD_USERPTR,
    };

    struct buffer {
           void   *start;
           size_t  length;
    };

    static char            *dev_name;
    static enum io_method   io = IO_METHOD_MMAP;
    static int              fd = -1;
    struct buffer          *buffers;
    static unsigned int     n_buffers;
    static int              out_buf;
    static int              force_format = 0;
    static int              frame_count = 100;

    static void errno_exit(const char *s)
    {
           fprintf(stderr, "%s error %d, %s\n", s, errno, strerror(errno));
           exit(EXIT_FAILURE);
    }

    static int xioctl(int fh, int request, void *arg)
    {
           int r;

           do {
                   r = ioctl(fh, request, arg);
           } while (-1 == r &amp;&amp; EINTR == errno);

           return r;
    }

    static void process_image(const void *p, int size)
    {
           if (out_buf)
                   fwrite(p, size, 1, stdout);

           fflush(stderr);
           fprintf(stderr, ".");
           fflush(stdout);
    }

    static int read_frame(void)
    {
           struct v4l2_buffer buf;
           unsigned int i;

           switch (io) {
           case IO_METHOD_READ:
                   if (-1 == read(fd, buffers[0].start, buffers[0].length)) {
                           switch (errno) {
                           case EAGAIN:
                                   return 0;

                           case EIO:
                                   /* Could ignore EIO, see spec. */

                                   /* fall through */

                           default:
                                   errno_exit("read");
                           }
                   }

                   process_image(buffers[0].start, buffers[0].length);
                   break;

           case IO_METHOD_MMAP:
                   CLEAR(buf);

                   buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                   buf.memory = V4L2_MEMORY_MMAP;

                   if (-1 == xioctl(fd, VIDIOC_DQBUF, &amp;buf)) {
                           switch (errno) {
                           case EAGAIN:
                                   return 0;

                           case EIO:
                                   /* Could ignore EIO, see spec. */

                                   /* fall through */

                           default:
                                   errno_exit("VIDIOC_DQBUF");
                           }
                   }

                   assert(buf.index &lt; n_buffers);

                   process_image(buffers[buf.index].start, buf.bytesused);

                   if (-1 == xioctl(fd, VIDIOC_QBUF, &amp;buf))
                           errno_exit("VIDIOC_QBUF");
                   break;

           case IO_METHOD_USERPTR:
                   CLEAR(buf);

                   buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                   buf.memory = V4L2_MEMORY_USERPTR;

                   if (-1 == xioctl(fd, VIDIOC_DQBUF, &amp;buf)) {
                           switch (errno) {
                           case EAGAIN:
                                   return 0;

                           case EIO:
                                   /* Could ignore EIO, see spec. */

                                   /* fall through */

                           default:
                                   errno_exit("VIDIOC_DQBUF");
                           }
                   }

                   for (i = 0; i &lt; n_buffers; ++i)
                           if (buf.m.userptr == (unsigned long)buffers[i].start
                               &amp;&amp; buf.length == buffers[i].length)
                                   break;

                   assert(i &lt; n_buffers);

                   process_image((void *)buf.m.userptr, buf.bytesused);

                   if (-1 == xioctl(fd, VIDIOC_QBUF, &amp;buf))
                           errno_exit("VIDIOC_QBUF");
                   break;
           }

           return 1;
    }

    static void mainloop(void)
    {
           unsigned int count;
       unsigned int loopIsInfinite = 0;

           if (frame_count == 0) loopIsInfinite = 1; //infinite loop
       count = frame_count;

           while ((count-- > 0) || loopIsInfinite) {
                   for (;;) {
                           fd_set fds;
                           struct timeval tv;
                           int r;

                           FD_ZERO(&amp;fds);
                           FD_SET(fd, &amp;fds);

                           /* Timeout. */
                           tv.tv_sec = 2;
                           tv.tv_usec = 0;

                           r = select(fd + 1, &amp;fds, NULL, NULL, &amp;tv);

                           if (-1 == r) {
                                   if (EINTR == errno)
                                           continue;
                                   errno_exit("select");
                           }

                           if (0 == r) {
                                   fprintf(stderr, "select timeout\n");
                                   exit(EXIT_FAILURE);
                           }

                           if (read_frame())
                                   break;
                           /* EAGAIN - continue select loop. */
                   }
           }
    }

    static void stop_capturing(void)
    {
           enum v4l2_buf_type type;

           switch (io) {
           case IO_METHOD_READ:
                   /* Nothing to do. */
                   break;

           case IO_METHOD_MMAP:
           case IO_METHOD_USERPTR:
                   type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                   if (-1 == xioctl(fd, VIDIOC_STREAMOFF, &amp;type))
                           errno_exit("VIDIOC_STREAMOFF");
                   break;
           }
    }

    static void start_capturing(void)
    {
           unsigned int i;
           enum v4l2_buf_type type;

           switch (io) {
           case IO_METHOD_READ:
                   /* Nothing to do. */
                   break;

           case IO_METHOD_MMAP:
                   for (i = 0; i &lt; n_buffers; ++i) {
                           struct v4l2_buffer buf;

                           CLEAR(buf);
                           buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                           buf.memory = V4L2_MEMORY_MMAP;
                           buf.index = i;

                           if (-1 == xioctl(fd, VIDIOC_QBUF, &amp;buf))
                                   errno_exit("VIDIOC_QBUF");
                   }
                   type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                   if (-1 == xioctl(fd, VIDIOC_STREAMON, &amp;type))
                           errno_exit("VIDIOC_STREAMON");
                   break;

           case IO_METHOD_USERPTR:
                   for (i = 0; i &lt; n_buffers; ++i) {
                           struct v4l2_buffer buf;

                           CLEAR(buf);
                           buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                           buf.memory = V4L2_MEMORY_USERPTR;
                           buf.index = i;
                           buf.m.userptr = (unsigned long)buffers[i].start;
                           buf.length = buffers[i].length;

                           if (-1 == xioctl(fd, VIDIOC_QBUF, &amp;buf))
                                   errno_exit("VIDIOC_QBUF");
                   }
                   type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                   if (-1 == xioctl(fd, VIDIOC_STREAMON, &amp;type))
                           errno_exit("VIDIOC_STREAMON");
                   break;
           }
    }

    static void uninit_device(void)
    {
           unsigned int i;

           switch (io) {
           case IO_METHOD_READ:
                   free(buffers[0].start);
                   break;

           case IO_METHOD_MMAP:
                   for (i = 0; i &lt; n_buffers; ++i)
                           if (-1 == munmap(buffers[i].start, buffers[i].length))
                                   errno_exit("munmap");
                   break;

           case IO_METHOD_USERPTR:
                   for (i = 0; i &lt; n_buffers; ++i)
                           free(buffers[i].start);
                   break;
           }

           free(buffers);
    }

    static void init_read(unsigned int buffer_size)
    {
           buffers = calloc(1, sizeof(*buffers));

           if (!buffers) {
                   fprintf(stderr, "Out of memory\n");
                   exit(EXIT_FAILURE);
           }

           buffers[0].length = buffer_size;
           buffers[0].start = malloc(buffer_size);

           if (!buffers[0].start) {
                   fprintf(stderr, "Out of memory\n");
                   exit(EXIT_FAILURE);
           }
    }

    static void init_mmap(void)
    {
           struct v4l2_requestbuffers req;

           CLEAR(req);

           req.count = 4;
           req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
           req.memory = V4L2_MEMORY_MMAP;

           if (-1 == xioctl(fd, VIDIOC_REQBUFS, &amp;req)) {
                   if (EINVAL == errno) {
                           fprintf(stderr, "%s does not support "
                                    "memory mapping\n", dev_name);
                           exit(EXIT_FAILURE);
                   } else {
                           errno_exit("VIDIOC_REQBUFS");
                   }
           }

           if (req.count &lt; 2) {
                   fprintf(stderr, "Insufficient buffer memory on %s\n",
                            dev_name);
                   exit(EXIT_FAILURE);
           }

           buffers = calloc(req.count, sizeof(*buffers));

           if (!buffers) {
                   fprintf(stderr, "Out of memory\n");
                   exit(EXIT_FAILURE);
           }

           for (n_buffers = 0; n_buffers &lt; req.count; ++n_buffers) {
                   struct v4l2_buffer buf;

                   CLEAR(buf);

                   buf.type        = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                   buf.memory      = V4L2_MEMORY_MMAP;
                   buf.index       = n_buffers;

                   if (-1 == xioctl(fd, VIDIOC_QUERYBUF, &amp;buf))
                           errno_exit("VIDIOC_QUERYBUF");

                   buffers[n_buffers].length = buf.length;
                   buffers[n_buffers].start =
                           mmap(NULL /* start anywhere */,
                                 buf.length,
                                 PROT_READ | PROT_WRITE /* required */,
                                 MAP_SHARED /* recommended */,
                                 fd, buf.m.offset);

                   if (MAP_FAILED == buffers[n_buffers].start)
                           errno_exit("mmap");
           }
    }

    static void init_userp(unsigned int buffer_size)
    {
           struct v4l2_requestbuffers req;

           CLEAR(req);

           req.count  = 4;
           req.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE;
           req.memory = V4L2_MEMORY_USERPTR;

           if (-1 == xioctl(fd, VIDIOC_REQBUFS, &amp;req)) {
                   if (EINVAL == errno) {
                           fprintf(stderr, "%s does not support "
                                    "user pointer i/o\n", dev_name);
                           exit(EXIT_FAILURE);
                   } else {
                           errno_exit("VIDIOC_REQBUFS");
                   }
           }

           buffers = calloc(4, sizeof(*buffers));

           if (!buffers) {
                   fprintf(stderr, "Out of memory\n");
                   exit(EXIT_FAILURE);
           }

           for (n_buffers = 0; n_buffers &lt; 4; ++n_buffers) {
                   buffers[n_buffers].length = buffer_size;
                   buffers[n_buffers].start = malloc(buffer_size);

                   if (!buffers[n_buffers].start) {
                           fprintf(stderr, "Out of memory\n");
                           exit(EXIT_FAILURE);
                   }
           }
    }

    static void init_device(void)
    {
           struct v4l2_capability cap;
           struct v4l2_cropcap cropcap;
           struct v4l2_crop crop;
           struct v4l2_format fmt;
           unsigned int min;

           if (-1 == xioctl(fd, VIDIOC_QUERYCAP, &amp;cap)) {
                   if (EINVAL == errno) {
                           fprintf(stderr, "%s is no V4L2 device\n",
                                    dev_name);
                           exit(EXIT_FAILURE);
                   } else {
                           errno_exit("VIDIOC_QUERYCAP");
                   }
           }

           if (!(cap.capabilities &amp; V4L2_CAP_VIDEO_CAPTURE)) {
                   fprintf(stderr, "%s is no video capture device\n",
                            dev_name);
                   exit(EXIT_FAILURE);
           }

           switch (io) {
           case IO_METHOD_READ:
                   if (!(cap.capabilities &amp; V4L2_CAP_READWRITE)) {
                           fprintf(stderr, "%s does not support read i/o\n",
                                    dev_name);
                           exit(EXIT_FAILURE);
                   }
                   break;

           case IO_METHOD_MMAP:
           case IO_METHOD_USERPTR:
                   if (!(cap.capabilities &amp; V4L2_CAP_STREAMING)) {
                           fprintf(stderr, "%s does not support streaming i/o\n",
                                    dev_name);
                           exit(EXIT_FAILURE);
                   }
                   break;
           }


           /* Select video input, video standard and tune here. */


           CLEAR(cropcap);

           cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

           if (0 == xioctl(fd, VIDIOC_CROPCAP, &amp;cropcap)) {
                   crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                   crop.c = cropcap.defrect; /* reset to default */

                   if (-1 == xioctl(fd, VIDIOC_S_CROP, &amp;crop)) {
                           switch (errno) {
                           case EINVAL:
                                   /* Cropping not supported. */
                                   break;
                           default:
                                   /* Errors ignored. */
                                   break;
                           }
                   }
           } else {
                   /* Errors ignored. */
           }


           CLEAR(fmt);

           fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
       fprintf(stderr, "Force Format %d\n", force_format);
           if (force_format) {
           if (force_format==2){
                       fmt.fmt.pix.width       = 1920;    
                   fmt.fmt.pix.height      = 1080;  
               fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_H264;
                       fmt.fmt.pix.field       = V4L2_FIELD_INTERLACED;
           }
           else if(force_format==1){
               fmt.fmt.pix.width   = 640;
               fmt.fmt.pix.height  = 480;
               fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
               fmt.fmt.pix.field   = V4L2_FIELD_INTERLACED;
           }

                   if (-1 == xioctl(fd, VIDIOC_S_FMT, &amp;fmt))
                           errno_exit("VIDIOC_S_FMT");

                   /* Note VIDIOC_S_FMT may change width and height. */
           } else {
                   /* Preserve original settings as set by v4l2-ctl for example */
                   if (-1 == xioctl(fd, VIDIOC_G_FMT, &amp;fmt))
                           errno_exit("VIDIOC_G_FMT");
           }

           /* Buggy driver paranoia. */
           min = fmt.fmt.pix.width * 2;
           if (fmt.fmt.pix.bytesperline &lt; min)
                   fmt.fmt.pix.bytesperline = min;
           min = fmt.fmt.pix.bytesperline * fmt.fmt.pix.height;
           if (fmt.fmt.pix.sizeimage &lt; min)
                   fmt.fmt.pix.sizeimage = min;

           switch (io) {
           case IO_METHOD_READ:
                   init_read(fmt.fmt.pix.sizeimage);
                   break;

           case IO_METHOD_MMAP:
                   init_mmap();
                   break;

           case IO_METHOD_USERPTR:
                   init_userp(fmt.fmt.pix.sizeimage);
                   break;
           }
    }

    static void close_device(void)
    {
           if (-1 == close(fd))
                   errno_exit("close");

           fd = -1;
    }

    static void open_device(void)
    {
           struct stat st;

           if (-1 == stat(dev_name, &amp;st)) {
                   fprintf(stderr, "Cannot identify '%s': %d, %s\n",
                            dev_name, errno, strerror(errno));
                   exit(EXIT_FAILURE);
           }

           if (!S_ISCHR(st.st_mode)) {
                   fprintf(stderr, "%s is no device\n", dev_name);
                   exit(EXIT_FAILURE);
           }

           fd = open(dev_name, O_RDWR /* required */ | O_NONBLOCK, 0);

           if (-1 == fd) {
                   fprintf(stderr, "Cannot open '%s': %d, %s\n",
                            dev_name, errno, strerror(errno));
                   exit(EXIT_FAILURE);
           }
    }

    static void usage(FILE *fp, int argc, char **argv)
    {
           fprintf(fp,
                    "Usage: %s [options]\n\n"
                    "Version 1.3\n"
                    "Options:\n"
                    "-d | --device name   Video device name [%s]\n"
                    "-h | --help          Print this message\n"
                    "-m | --mmap          Use memory mapped buffers [default]\n"
                    "-r | --read          Use read() calls\n"
                    "-u | --userp         Use application allocated buffers\n"
                    "-o | --output        Outputs stream to stdout\n"
                    "-f | --format        Force format to 640x480 YUYV\n"
            "-F | --formatH264    Force format to 1920x1080 H264\n"
                    "-c | --count         Number of frames to grab [%i] - use 0 for infinite\n"
                    "\n"
            "Example usage: capture -F -o -c 300 > output.raw\n"
            "Captures 300 frames of H264 at 1920x1080 - use raw2mpg4 script to convert to mpg4\n",
                    argv[0], dev_name, frame_count);
    }

    static const char short_options[] = "d:hmruofFc:";

    static const struct option
    long_options[] = {
           { "device", required_argument, NULL, 'd' },
           { "help",   no_argument,       NULL, 'h' },
           { "mmap",   no_argument,       NULL, 'm' },
           { "read",   no_argument,       NULL, 'r' },
           { "userp",  no_argument,       NULL, 'u' },
           { "output", no_argument,       NULL, 'o' },
           { "format", no_argument,       NULL, 'f' },
       { "formatH264", no_argument,   NULL, 'F' },
           { "count",  required_argument, NULL, 'c' },
           { 0, 0, 0, 0 }
    };

    int main(int argc, char **argv)
    {
           dev_name = "/dev/video0";

           for (;;) {
                   int idx;
                   int c;

                   c = getopt_long(argc, argv,
                                   short_options, long_options, &amp;idx);

                   if (-1 == c)
                           break;

                   switch (c) {
                   case 0: /* getopt_long() flag */
                           break;

                   case 'd':
                           dev_name = optarg;
                           break;

                   case 'h':
                           usage(stdout, argc, argv);
                           exit(EXIT_SUCCESS);

                   case 'm':
                           io = IO_METHOD_MMAP;
                           break;

                   case 'r':
                           io = IO_METHOD_READ;
                           break;

                   case 'u':
                           io = IO_METHOD_USERPTR;
                           break;

                   case 'o':
                           out_buf++;
                           break;

                   case 'f':
                           force_format=1;
                           break;

           case 'F':
               force_format=2;
               break;

                   case 'c':
                           errno = 0;
                           frame_count = strtol(optarg, NULL, 0);
                           if (errno)
                                   errno_exit(optarg);
                           break;

                   default:
                           usage(stderr, argc, argv);
                           exit(EXIT_FAILURE);
                   }
           }

           open_device();
           init_device();
           start_capturing();
           mainloop();
           stop_capturing();
           uninit_device();
           close_device();
           fprintf(stderr, "\n");
           return 0;
    }

    It’s a modified version of a V4L2 video capture example.
    Then I know that if I have outputed the streame to a file I would have to run this command to convert the raw format to mp4 format :

    ffmpeg -f h264 -i output.raw -vcodec copy output.mp4

    And the v4l2loopback program I’m using is foud here :
    https://github.com/umlaeute/v4l2loopback

    ------------------Update------------------

    Okay. So I got the pipe from the capture program to ffmpeg working. It captures, decodes the h264 and I can write it to a mp4 file with this command :

    ./capture -F -d /dev/video0 -o | ffmpeg -f h264 -i - -vcodec copy out.mp4

    Now I am trying to get the last pipe working with this command :

    ./capture -F -d /dev/video0 -o | ffmpeg -f h264 -i - -vcodec copy -f mp4 - | gst-launch-0.10 -v fdsrc ! v4l2sink device=/dev/video3

    I get these errors :

    • muxer does not support non seekable output
    • Could not write header for output file #0 (incorrect codec parameters ?) : Invalid argument

    Any ideas ?

  • What causes Firefox to refuse playing one specific MP4 that plays well on other browsers, resolution being the only difference ?

    3 décembre 2014, par Faro

    I’m a developer for a PHP powered website that allows the upload of videos which get converted to MP4 using ffmpeg. This setup worked pretty well so far, however today I came across a report of a user that couldn’t play one of the files in Firefox.

    I was unable to replicate the issue on my own machine at first, but using a fresh install of Windows 7 I actually got the same issue : The file will not play in Firefox, but works fine in Chrome. If called up directly, Firefox will say "Video can’t be played because the file is corrupt".
    When downloaded, Windows will also not create a thumbnail of the video for the file and WMP will only play the audio part.

    On my own machine the file works perfectly in WMP which made me wonder if it could be a codec issue (I do have the K-Lite Codec Pack installed), however I’ve compared the file to a working one and the only difference is the resolution, filesize and the format profile which is "High@L3.1" for a working file with a 720p resolution and "High@L4.0" for the non-working one (which is 1600x1200).

    I then read through the Wikipedia article on H.264/MPEG-4 AVC and began to wonder if the level might be the issue, and the tool I used (XMedia Recode) actually did not allow me to set a height bigger than 1080 on Level 4, however when I set the level to 5 and encoded the file again, it still wouldn’t play.

    I did find a note on the MDN page of supported formats which reads :

    Firefox/Firefox for Android/Firefox OS supports the format in some cases, but only when a third-party decoder is available, and the device hardware can handle the profile used to encode the MP4.

    I’m assuming that is why the codec pack would allow Firefox to play even the ’broken’ file on my machine, I still don’t understand though why Firefox does play some files but not this one, especially when Chrome on the same machine plays all of them.

    The line in PHP that starts the conversion is as follows :

    exec("/usr/local/bin/ffmpeg '-i' '" . $file_in . "' '-qscale' '4' '-y' '-threads' '1' '-acodec' 'libvo_aacenc' '-vcodec' 'h264' '" . $file_out . "' 2>&amp;1", $buffer, $success);

    This should produce correct files, and this is indeed the first time a file has issues.

    MediaInfo provides this data for the file stream :

    Video
    ID                                       : 1
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4.0
    Format settings, CABAC                   : Yes
    Format settings, ReFrames                : 4 frames
    Codec ID                                 : avc1
    Codec ID/Info                            : Advanced Video Coding
    Duration                                 : 12mn 26s
    Bit rate                                 : 77.7 Kbps
    Width                                    : 1 600 pixels
    Height                                   : 1 200 pixels
    Display aspect ratio                     : 4:3
    Frame rate mode                          : Constant
    Frame rate                               : 30.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Bits/(Pixel*Frame)                       : 0.001
    Stream size                              : 6.92 MiB (36%)
    Writing library                          : x264 core 142 r14 956c8d8
    Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=1 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    Language                                 : English

    Audio
    ID                                       : 2
    Format                                   : AAC
    Format/Info                              : Advanced Audio Codec
    Format profile                           : LC
    Codec ID                                 : 40
    Duration                                 : 12mn 26s
    Duration_LastFrame                       : -10ms
    Bit rate mode                            : Constant
    Bit rate                                 : 128 Kbps
    Channel(s)                               : 2 channels
    Channel positions                        : Front: L R
    Sampling rate                            : 44.1 KHz
    Compression mode                         : Lossy
    Stream size                              : 11.4 MiB (60%)
    Language                                 : English

    I’ve uploaded a zip with 3 versions of the file, the untouched one, the converted one with the same settings the website would use, and another converted one with level 5.

    Maybe I’m missing something obvious, but I couldn’t find anything wrong with it, what do I need to change in order to produce a file that will work natively in Firefox ?

    Also, this is my first question on SO, so if you see anything that I can improve, please let me know :-)

    Edit : This is the output of calling ffmpeg (with the faststart option)

    /usr/local/bin/ffmpeg '-i' '49cf594e91d0dac376aa0b2b96972ded.mp4' '-movflags' '+faststart' '-qscale' '4' '-y' '-threads' '1' '-acodec' 'libvo_aacenc' '-vcodec' 'h264' 'test.mp4'

    ffmpeg version 1.2.5-   http://johnvansickle.com/ffmpeg/    Copyright (c) 2000-2014 the FFmpeg developers
     built on Jan 22 2014 20:28:02 with gcc 4.8 (Debian 4.8.2-14)
     configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --disable-ffserver
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
     libpostproc    52.  2.100 / 52.  2.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '49cf594e91d0dac376aa0b2b96972ded.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf54.63.104
     Duration: 00:12:26.37, start: 0.036281, bitrate: 214 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1600x1200 [SAR 1:1 DAR 4:3], 77 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
       Metadata:
         handler_name    : SoundHandler
    Please use -q:a or -q:v, -qscale is ambiguous
    [libx264 @ 0x2802ac0] using SAR=1/1
    [libx264 @ 0x2802ac0] using cpu capabilities: MMX2 SSE2Fast LZCNT
    [libx264 @ 0x2802ac0] profile High, level 4.0
    [libx264 @ 0x2802ac0] 264 - core 142 r14 956c8d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'test.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf54.63.104
       Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1600x1200 [SAR 1:1 DAR 4:3], q=-1--1, 15360 tbn, 30 tbc
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 -> libx264)
     Stream #0:1 -> #0:1 (aac -> libvo_aacenc)
    Press [q] to stop, [?] for help
    Starting second pass: moving header on top of the file30.77 bitrate= 202.5kbits/s dup=1 drop=0
    frame=15331 fps= 13 q=29.0 Lsize=   13201kB time=00:08:31.03 bitrate= 211.6kbits/s dup=1 drop=0
    video:4673kB audio:7986kB subtitle:0 global headers:0kB muxing overhead 4.286767%
    [libx264 @ 0x2802ac0] frame I:63    Avg QP:12.37  size: 39759
    [libx264 @ 0x2802ac0] frame P:3905  Avg QP:20.36  size:   313
    [libx264 @ 0x2802ac0] frame B:11363 Avg QP:33.67  size:    93
    [libx264 @ 0x2802ac0] consecutive B-frames:  1.1%  0.1%  0.2% 98.6%
    [libx264 @ 0x2802ac0] mb I  I16..4: 48.0% 41.5% 10.5%
    [libx264 @ 0x2802ac0] mb P  I16..4:  0.1%  0.2%  0.0%  P16..4:  0.5%  0.0%  0.0%  0.0%  0.0%    skip:99.1%
    [libx264 @ 0x2802ac0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.3%  0.0%  0.0%  direct: 0.0%  skip:99.7%  L0:50.2% L1:48.9% BI: 0.8%
    [libx264 @ 0x2802ac0] 8x8 transform intra:42.4% inter:36.9%
    [libx264 @ 0x2802ac0] coded y,uvDC,uvAC intra: 6.9% 13.4% 9.4% inter: 0.0% 0.1% 0.0%
    [libx264 @ 0x2802ac0] i16 v,h,dc,p: 82% 17%  1%  0%
    [libx264 @ 0x2802ac0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 20% 49%  0%  0%  0%  0%  0%  0%
    [libx264 @ 0x2802ac0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 20% 18%  3%  4%  4%  4%  4%  3%
    [libx264 @ 0x2802ac0] i8c dc,h,v,p: 80% 12%  7%  1%
    [libx264 @ 0x2802ac0] Weighted P-Frames: Y:0.3% UV:0.3%
    [libx264 @ 0x2802ac0] ref P L0: 74.7%  3.8% 10.6% 10.9%  0.0%
    [libx264 @ 0x2802ac0] ref B L0: 70.3% 28.9%  0.8%
    [libx264 @ 0x2802ac0] ref B L1: 97.9%  2.1%
    [libx264 @ 0x2802ac0] kb/s:74.90
  • Converting .mp4 to .webm with FFMPEG

    24 septembre 2012, par DAVYM

    Any chance someone can help me make this a 2 or 3 pass command :

    Using "FFmpeg Win64 Static build by Kyle Schwarz, compiled on : Sep 19 2012 16:31:43" in the Command Prompt of Windows7(x64). I am a newbie to FFMPEG and trying to convert videos for my website from .mp4 to .webm (videos edited and mixed in AdobePremiereProCS6 where then encoded into .mp4 from .mts Canon HXG10 recordings). Original video file is 1080p quality.

    c :\ff/ffmpeg -i c :\ff/xxx.mp4 -codec:v libvpx -quality good -cpu-used
    0 -b:v 7000k -qmin 10 -qmax 42 -maxrate 500k -bufsize 1500k -threads 8
    -vf scale=-1:1080 -codec:a libvorbis -b:a 192k -f webm c :\ff/xxx.webm