Recherche avancée

Médias (0)

Mot : - Tags -/masques

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (58)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Prérequis à l’installation

    31 janvier 2010, par

    Préambule
    Cet article n’a pas pour but de détailler les installations de ces logiciels mais plutôt de donner des informations sur leur configuration spécifique.
    Avant toute chose SPIPMotion tout comme MediaSPIP est fait pour tourner sur des distributions Linux de type Debian ou dérivées (Ubuntu...). Les documentations de ce site se réfèrent donc à ces distributions. Il est également possible de l’utiliser sur d’autres distributions Linux mais aucune garantie de bon fonctionnement n’est possible.
    Il (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (10304)

  • Reading in pydub AudioSegment from url. BytesIO returning "OSError [Errno 2] No such file or directory" on heroku only ; fine on localhost

    24 octobre 2014, par Mark

    EDIT 1 for anyone with the same error : installing ffmpeg did indeed solve that BytesIO error

    EDIT 1 for anyone still willing to help : my problem is now that when I AudioSegment.export("filename.mp3", format="mp3"), the file is made, but has size 0 bytes — details below (as "EDIT 1")


    EDIT 2 : All problems now solved.

    • Files can be read in as AudioSegment using BytesIO
    • I found buildpacks to ensure ffmpeg was installed correctly on my app, with lame support for exporting proper mp3 files

    Answer below


    Original question

    I have pydub working nicely locally to crop a particular mp3 file based on parameters in the url.
    (?start_time=3.8&end_time=5.1)

    When I run foreman start it all looks good on localhost. The html renders nicely.
    The key lines from the views.py include reading in a file from a url using

    url = "https://s3.amazonaws.com/shareducate02/The_giving_tree__by_Alex_Blumberg__sponsored_by_mailchimp-short.mp3"
    mp3 = urllib.urlopen(url).read() # inspired by http://nbviewer.ipython.org/github/ipython-books/cookbook-code/blob/master/notebooks/chapter11_image/06_speech.ipynb
    original=AudioSegment.from_mp3(BytesIO(mp3))  # AudioSegment.from_mp3 is a pydub command, see http://pydub.com
    section = original[start_time_ms:end_time_ms]

    That all works great... until I push to heroku (django app) and run it online.
    then when I load the same page now on the herokuapp.com, I get this error

    OSError at /path/to/page
    [Errno 2] No such file or directory
    Request Method: GET
    Request URL:    http://my.website.com/path/to/page?start_time=3.8&end_time=5
    Django Version: 1.6.5
    Exception Type: OSError
    Exception Value:    
    [Errno 2] No such file or directory
    Exception Location: /app/.heroku/python/lib/python2.7/subprocess.py in _execute_child, line 1327
    Python Executable:  /app/.heroku/python/bin/python
    Python Version: 2.7.8
    Python Path:    
    ['/app',
    '/app/.heroku/python/bin',
    '/app/.heroku/python/lib/python2.7/site-packages/setuptools-5.4.1-py2.7.egg',
    '/app/.heroku/python/lib/python2.7/site-packages/distribute-0.6.36-py2.7.egg',
    '/app/.heroku/python/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg',
    '/app',
    '/app/.heroku/python/lib/python27.zip',
    '/app/.heroku/python/lib/python2.7',
    '/app/.heroku/python/lib/python2.7/plat-linux2',
    '/app/.heroku/python/lib/python2.7/lib-tk',
    '/app/.heroku/python/lib/python2.7/lib-old',
    '/app/.heroku/python/lib/python2.7/lib-dynload',
    '/app/.heroku/python/lib/python2.7/site-packages',
    '/app/.heroku/python/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']


    Traceback:
    File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
     112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "/app/evernote/views.py" in finalize
     105.       original=AudioSegment.from_mp3(BytesIO(mp3))
    File "/app/.heroku/python/lib/python2.7/site-packages/pydub/audio_segment.py" in from_mp3
     318.         return cls.from_file(file, 'mp3')
    File "/app/.heroku/python/lib/python2.7/site-packages/pydub/audio_segment.py" in from_file
     302.         retcode = subprocess.call(convertion_command, stderr=open(os.devnull))
    File "/app/.heroku/python/lib/python2.7/subprocess.py" in call
     522.     return Popen(*popenargs, **kwargs).wait()
    File "/app/.heroku/python/lib/python2.7/subprocess.py" in __init__
     710.                                 errread, errwrite)
    File "/app/.heroku/python/lib/python2.7/subprocess.py" in _execute_child
     1327.                 raise child_exception

    I have commented out some of the original to convince myself that sure enough the single line original=AudioSegment.from_mp3(BytesIO(mp3)) is where the problem kicks in... but this is not a problem locally

    The full function in views.py starts like this :

    from django.shortcuts import render, get_object_or_404
    from django.http import HttpResponseRedirect #, Http404, HttpResponse
    from django.core.urlresolvers import reverse
    from django.views import generic
    import pydub
    # Maybe only need:
    from pydub import AudioSegment # == see below
    from time import gmtime, strftime

    import boto
    from boto.s3.connection import S3Connection
    from boto.s3.key import Key

    # http://nbviewer.ipython.org/github/ipython-books/cookbook-code/blob/master/notebooks/chapter11_image/06_speech.ipynb
    import urllib
    from io import BytesIO
    # import numpy as np
    # import scipy.signal as sg
    # import pydub # mentioned above already
    # import matplotlib.pyplot as plt
    # from IPython.display import Audio, display
    # import matplotlib as mpl
    # %matplotlib inline

    import os
    # from settings import AWS_ACCESS_KEY, AWS_SECRET_KEY, AWS_BUCKET_NAME
    AWS_ACCESS_KEY = os.environ.get('AWS_ACCESS_KEY') # there must be a better way?
    AWS_SECRET_KEY = os.environ.get('AWS_SECRET_KEY')
    AWS_BUCKET_NAME = os.environ.get('S3_BUCKET_NAME')

    # http://stackoverflow.com/questions/415511/how-to-get-current-time-in-python

    boto_conn = S3Connection(AWS_ACCESS_KEY, AWS_SECRET_KEY)
    bucket = boto_conn.get_bucket(AWS_BUCKET_NAME)
    s3_url_format = 'https://s3.amazonaws.com/shareducate02/{end_path}'

    and specifically the view in views.py that’s called when I visit the page :

    def finalize(request):

       start_time = request.GET.get('start_time')

       end_time = request.GET.get('end_time')

       original_file = "https://s3.amazonaws.com/shareducate02/The_giving_tree__by_Alex_Blumberg__sponsored_by_mailchimp-short.mp3"


       if start_time:

         # original=AudioSegment.from_mp3(original_file)  #...that didn't work
         # but this works below:

         # next three uncommented lines from http://nbviewer.ipython.org/github/ipython-books/cookbook-code/blob/master/notebooks/chapter11_image/06_speech.ipynb
         # python 2.x
         url = original_file
         # req = urllib.Request(url, headers={'User-Agent': ''}) # Note: I commented out this because I got error that "Request" did not exist
         mp3 = urllib.urlopen(url).read()
         # That's for my 2.7

         # If I ever upgrade to python 3.x, would need to change it to:
         # req = urllib.request.Request(url, headers={'User-Agent': ''})
         # mp3 = urllib.request.urlopen(req).read()
         # as per instructions on http://nbviewer.ipython.org/github/ipython-books/cookbook-code/blob/master/notebooks/chapter11_image/06_speech.ipynb

         original=AudioSegment.from_mp3(BytesIO(mp3))
         # original=AudioSegment.from_mp3("static/givingtree.mp3") # alternative that works locally (on laptop) but no use for heroku

         start_time_ms = int(float(start_time) * 1000)
         if end_time:
           end_time_ms = int(float(end_time) * 1000)
         else:
           end_time_ms = int(float(original.duration_seconds) * 1000)
         duration_ms = end_time_ms - start_time_ms
         # duration = end_time - start_time
         duration = duration_ms/1000

      #   section = original[start_time_ms:end_time_ms]
      #   section_with_fading = section.fade_in(100).fade_out(100)

         clip = "demo-"
         number = strftime("%Y-%m-%d_%H-%M-%S", gmtime())
         clip += number
         clip += ".mp3"

         # DON'T BOTHER writing locally:
         # clip_with_path = "evernote/static/"+clip
         # section_with_fading.export(clip_with_path, format = "mp3")

      #   tempclip = section_with_fading.export(format = "mp3")

         # commented out while de-bugging, but was working earlier if run on localhost
         # c = boto.connect_s3()
         # b = c.get_bucket(S3_BUCKET_NAME)  # as defined above
         # k = Key(b)
         # k.key=clip
         # # k.set_contents_from_filename(clip_with_path)
         # k.set_contents_from_file(tempclip)
         # k.set_acl('public-read')
         clip_made = True
       else:
         duration = 0.0
         clip_made = False
         clip = ""
       context = {'original_file':original_file, 'new_file':clip, 'start_time': start_time, 'end_time':end_time, 'duration':duration, 'clip_made':clip_made}
       return render(request, 'finalize.html' , context)

    Any suggestions ?

    Potentially related :
    I have ffmpeg installed locally

    But have been unable to install it onto heroku, due to not understanding buildpacks. I tried just a moment ago (http://stackoverflow.com/questions/14407388/how-to-install-ffmpeg-for-a-django-app-on-heroku and https://github.com/shunjikonishi/heroku-buildpack-ffmpeg) but so far ffmpeg is not working on heroku (ffmpeg is not recognised when I do "heroku run ffmpeg —version")
    ...do you think this is the reason ?

    An answer like any of these would be much appreciated as I’m going round in circles here :

    1. "I think ffmpeg is indeed your problem. Try harder to sort that out, to get it installed on heroku"
    2. "Actually, I think this is why BytesIO is not working for you : ..."
    3. "Your approach is terrible anyway... if you want to read in an audio file to process using pydub, you should just do this instead : ..." (since I’m just hacking my way through pydub for my first time... my approach may be poor)

    EDIT 1

    ffmpeg is now installed (e.g., I can output wav files)

    However, I can’t create mp3 files, still... or more correctly, I can, but the filesize is zero

    (venv-app)moriartymacbookair13:getstartapp macuser$ heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
    Setting config vars and restarting awe01... done, v93
    BUILDPACK_URL: https://github.com/ddollar/heroku-buildpack-multi.git
    (venv-app)moriartymacbookair13:getstartapp macuser$ vim .buildpacks
    (venv-app)moriartymacbookair13:getstartapp macuser$ cat .buildpacks
    https://github.com/shunjikonishi/heroku-buildpack-ffmpeg.git
    https://github.com/heroku/heroku-buildpack-python.git
    (venv-app)moriartymacbookair13:getstartapp macuser$ git add --all
    (venv-app)moriartymacbookair13:getstartapp macuser$ git commit -m "need multi, not just ffmpeg, so adding back in multi + shun + heroku, with trailing .git in .buildpacks file"
    [master cd99fef] need multi, not just ffmpeg, so adding back in multi + shun + heroku, with trailing .git in .buildpacks file
    1 file changed, 2 insertions(+), 2 deletions(-)
    (venv-app)moriartymacbookair13:getstartapp macuser$ git push heroku master
    Fetching repository, done.
    Counting objects: 5, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 372 bytes | 0 bytes/s, done.
    Total 3 (delta 2), reused 0 (delta 0)

    -----> Fetching custom git buildpack... done
    -----> Multipack app detected
    =====> Downloading Buildpack: https://github.com/shunjikonishi/heroku-buildpack-ffmpeg.git
    =====> Detected Framework: ffmpeg
    -----> Install ffmpeg
          DOWNLOAD_URL =  http://flect.github.io/heroku-binaries/libs/ffmpeg.tar.gz
          exporting PATH and LIBRARY_PATH
    =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-python.git
    =====> Detected Framework: Python
    -----> Installing dependencies with pip
          Cleaning up...

    -----> Preparing static assets
          Collectstatic configuration error. To debug, run:
          $ heroku run python ./example/manage.py collectstatic --noinput

    Using release configuration from last framework (Python).
    -----> Discovering process types
          Procfile declares types -> web

    -----> Compressing... done, 198.1MB
    -----> Launching... done, v94
          http://[redacted].herokuapp.com/ deployed to Heroku

    To git@heroku.com:awe01.git
      78d6b68..cd99fef  master -> master
    (venv-app)moriartymacbookair13:getstartapp macuser$ heroku run ffmpeg
    Running `ffmpeg` attached to terminal... up, run.6408
    ffmpeg version git-2013-06-02-5711e4f Copyright (c) 2000-2013 the FFmpeg developers
     built on Jun  2 2013 07:38:40 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
     configuration: --enable-shared --disable-asm --prefix=/app/vendor/ffmpeg
     libavutil      52. 34.100 / 52. 34.100
     libavcodec     55. 13.100 / 55. 13.100
     libavformat    55.  8.102 / 55.  8.102
     libavdevice    55.  2.100 / 55.  2.100
     libavfilter     3. 74.101 /  3. 74.101
     libswscale      2.  3.100 /  2.  3.100
     libswresample   0. 17.102 /  0. 17.102
    Hyper fast Audio and Video encoder
    usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

    Use -h to get full help or, even better, run 'man ffmpeg'
    (venv-app)moriartymacbookair13:getstartapp macuser$ heroku run bash
    Running `bash` attached to terminal... up, run.9660
    ~ $ python
    Python 2.7.8 (default, Jul  9 2014, 20:47:08)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pydub
    >>> from pydub import AudioSegment
    >>> exit()
    ~ $ which ffmpeg
    /app/vendor/ffmpeg/bin/ffmpeg
    ~ $ python

    Python 2.7.8 (default, Jul  9 2014, 20:47:08)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pydub
    >>> from pydub import AudioSegment
    >>> AudioSegment.silent(5000).export("/tmp/asdf.mp3", "mp3")
    <open file="file"></open>tmp/asdf.mp3', mode 'wb+' at 0x7f9a37d44780>
    >>> exit ()
    ~ $ cd /tmp/
    /tmp $ ls
    asdf.mp3
    /tmp $ open asdf.mp3
    bash: open: command not found
    /tmp $ ls -lah
    total 8.0K
    drwx------  2 u36483 36483 4.0K 2014-10-22 04:14 .
    drwxr-xr-x 14 root   root  4.0K 2014-09-26 07:08 ..
    -rw-------  1 u36483 36483    0 2014-10-22 04:14 asdf.mp3

    Note the file size of 0 above for the mp3 file... when I do the same thing on my macbook, the file size is never zero

    Back to the heroku shell :

    /tmp $ python
    Python 2.7.8 (default, Jul  9 2014, 20:47:08)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pydub
    >>> from pydub import AudioSegment
    >>> pydub.AudioSegment.ffmpeg = "/app/vendor/ffmpeg/bin/ffmpeg"
    >>> AudioSegment.silence(1200).export("/tmp/herokuSilence.mp3", format="mp3")
    Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
    AttributeError: type object 'AudioSegment' has no attribute 'silence'
    >>> AudioSegment.silent(1200).export("/tmp/herokuSilence.mp3", format="mp3")
    <open file="file"></open>tmp/herokuSilence.mp3', mode 'wb+' at 0x7fcc2017c780>
    >>> exit()
    /tmp $ ls
    asdf.mp3  herokuSilence.mp3
    /tmp $ ls -lah
    total 8.0K
    drwx------  2 u36483 36483 4.0K 2014-10-22 04:29 .
    drwxr-xr-x 14 root   root  4.0K 2014-09-26 07:08 ..
    -rw-------  1 u36483 36483    0 2014-10-22 04:14 asdf.mp3
    -rw-------  1 u36483 36483    0 2014-10-22 04:29 herokuSilence.mp3
    </module></stdin>

    I realised the first time that I had forgotten the pydub.AudioSegment.ffmpeg = "/app/vendor/ffmpeg/bin/ffmpeg" command, but as you can see above, the file is still zero size

    Out of desperation, I even tried adding the ".heroku" into the path to be as verbatim as your example, but that didn’t fix it :

    /tmp $ python
    Python 2.7.8 (default, Jul  9 2014, 20:47:08)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pydub
    >>> from pydub import AudioSegment
    >>> pydub.AudioSegment.ffmpeg = "/app/.heroku/vendor/ffmpeg/bin/ffmpeg"
    >>> AudioSegment.silent(1200).export("/tmp/herokuSilence03.mp3", format="mp3")
    <open file="file"></open>tmp/herokuSilence03.mp3', mode 'wb+' at 0x7fc92aca7780>
    >>> exit()
    /tmp $ ls -lah
    total 8.0K
    drwx------  2 u36483 36483 4.0K 2014-10-22 04:31 .
    drwxr-xr-x 14 root   root  4.0K 2014-09-26 07:08 ..
    -rw-------  1 u36483 36483    0 2014-10-22 04:14 asdf.mp3
    -rw-------  1 u36483 36483    0 2014-10-22 04:31 herokuSilence03.mp3
    -rw-------  1 u36483 36483    0 2014-10-22 04:29 herokuSilence.mp3

    Finally, I tried exporting a .wav file to check pydub was at least working correctly

    /tmp $ python
    Python 2.7.8 (default, Jul  9 2014, 20:47:08)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pydub
    >>> from pydub import AudioSegment
    >>> pydub.AudioSegment.ffmpeg = "/app/vendor/ffmpeg/bin/ffmpeg"
    >>> AudioSegment.silent(1300).export("/tmp/heroku_wav_silence01.wav", format="wav")
    <open file="file"></open>tmp/heroku_wav_silence01.wav', mode 'wb+' at 0x7fa33cbf3780>
    >>> exit()
    /tmp $ ls
    asdf.mp3  herokuSilence03.mp3  herokuSilence.mp3  heroku_wav_silence01.wav
    /tmp $ ls -lah
    total 40K
    drwx------  2 u36483 36483 4.0K 2014-10-22 04:42 .
    drwxr-xr-x 14 root   root  4.0K 2014-09-26 07:08 ..
    -rw-------  1 u36483 36483    0 2014-10-22 04:14 asdf.mp3
    -rw-------  1 u36483 36483    0 2014-10-22 04:31 herokuSilence03.mp3
    -rw-------  1 u36483 36483    0 2014-10-22 04:29 herokuSilence.mp3
    -rw-------  1 u36483 36483  29K 2014-10-22 04:42 heroku_wav_silence01.wav
    /tmp $

    At least that filesize for .wav is non-zero, so pydub is working

    My current theory is that either I’m still not using ffmpeg correctly, or it’s insufficient... maybe I need an mp3 additional install on top of basic ffmpeg.

    Several sites mention "libavcodec-extra-53" but I’m not sure how to install that on heroku, or to check if I have it ? https://github.com/jiaaro/pydub/issues/36
    Similarly tutorials on libmp3lame seem to be geared towards laptop installation rather than installation on heroku, so I’m at a loss http://superuser.com/questions/196857/how-to-install-libmp3lame-for-ffmpeg

    In case relevant, I also have youtube-dl in my requirements.txt... this also works locally on my macbook, but fails when I run it in the heroku shell :

    ~/ytdl $ youtube-dl --restrict-filenames -x --audio-format mp3 n2anDgdUHic
    [youtube] Setting language
    [youtube] Confirming age
    [youtube] n2anDgdUHic: Downloading webpage
    [youtube] n2anDgdUHic: Downloading video info webpage
    [youtube] n2anDgdUHic: Extracting video information
    [download] Destination: Boyce_Avenue_feat._Megan_Nicole_-_Skyscraper_Patrick_Ebert_Edit-n2anDgdUHic.m4a
    [download] 100% of 5.92MiB in 00:00
    [ffmpeg] Destination: Boyce_Avenue_feat._Megan_Nicole_-_Skyscraper_Patrick_Ebert_Edit-n2anDgdUHic.mp3
    ERROR: audio conversion failed: Unknown encoder 'libmp3lame'
    ~/ytdl $

    The informative link is that it too specificies an mp3 failure, so perhaps they two issues are related.


    EDIT 2

    See answer, all problems solved

  • HTML5 Video Chrome - ffmpeg - mp4 working in all but Chrome

    16 octobre 2014, par IIIOXIII

    I have successfully encoded a file to .mp4 using ffmpeg which will play in all tested devices (Safari on PC, IE on PC, Android Browser, Andriod Video Player, and Safari iPad), except for Chrome.

    As a work-around, I had planned to simply list the .ogg source prior to the .mp4 source so that chrome would play the .ogg source without even seeing the .mp4 source, however, I ran into the issue mentioned here.

    Basically, I am after the proper ffmpeg command which will encode an .mp4 video to standards which will play in Chrome - of course without losing playback functionality on any of the other previously mentioned platforms.

    I have tried several combinations, such as :

    ffmpeg -i [filename].wmv -vprofile baseline -level 30 -vf scale=640:-1 -movflags faststart [filename].mp4

    etc. but have not yet found the winning one.

    EDIT : I tried :

    ffmpeg_new -i [filename].wmv -strict experimental –acodec libvo_aacenc -ac 2 -ab 160k -vcodec libx264 -vf scale=640:-1 -pix_fmt yuv420p -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 [filename].mp4

    And here is the ffmpeg output :

    ffmpeg version N-54207-ge59fb3f Copyright (c) 2000-2013 the FFmpeg developers built on Jun 25 2013 21:55:00 with gcc 4.7.3 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
    e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
    ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
    ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
    eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
    amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
    enable-libxvid --enable-zlib
     libavutil      52. 37.101 / 52. 37.101
     libavcodec     55. 17.100 / 55. 17.100
     libavformat    55. 10.100 / 55. 10.100
     libavdevice    55.  2.100 / 55.  2.100
     libavfilter     3. 77.101 /  3. 77.101
     libswscale      2.  3.100 /  2.  3.100
     libswresample   0. 17.102 /  0. 17.102
     libpostproc    52.  3.100 / 52.  3.100
    [asf @ 000000000254f9e0] Stream #0: not enough frames to estimate rate; consider
    increasing probesize
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, asf, from 'C:\vidtests\Wildlife.wmv':
     Metadata:
       SfOriginalFPS   : 299700
       WMFSDKVersion   : 11.0.6001.7000
       WMFSDKNeeded    : 0.0.0.0000
       comment         : Footage: Small World Productions, Inc; Tourism New Zealand
    | Producer: Gary F. Spradling | Music: Steve Ball
       title           : Wildlife in HD
       copyright       : ┬⌐ 2008 Microsoft Corporation
       IsVBR           : 0
       DeviceConformanceTemplate: AP@L3
     Duration: 00:00:30.09, start: 0.000000, bitrate: 6977 kb/s
       Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo, fltp
    , 192 kb/s
       Stream #0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1280x7
    20, 5942 kb/s, 29.97 tbr, 1k tbn, 1k tbc
    Please use -b:a or -b:v, -b is ambiguous
    [libx264 @ 000000000264faa0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64

    [libx264 @ 000000000264faa0] profile Constrained Baseline, level 3.0
    [libx264 @ 000000000264faa0] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC cod
    ec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=0 r
    ef=5 deblock=1:0:0 analyse=0x1:0x111 me=umh subme=8 psy=1 psy_rd=1.00:0.00 mixed
    _ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pski
    p=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 deci
    mate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyi
    nt=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1
    bitrate=1200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=10000
    vbv_bufsize=10000 nal_hrd=none ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'C:\vidtests\Wildlife_SE1.mp4':
     Metadata:
       SfOriginalFPS   : 299700
       WMFSDKVersion   : 11.0.6001.7000
       WMFSDKNeeded    : 0.0.0.0000
       comment         : Footage: Small World Productions, Inc; Tourism New Zealand
    | Producer: Gary F. Spradling | Music: Steve Ball
       title           : Wildlife in HD
       copyright       : ┬⌐ 2008 Microsoft Corporation
       IsVBR           : 0
       DeviceConformanceTemplate: AP@L3
       encoder         : Lavf55.10.100
       Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 6
    40x360, q=-1--1, 1200 kb/s, 30k tbn, 29.97 tbc
       Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100
    Hz, stereo, s16, 160 kb/s
    Stream mapping:
     Stream #0:1 -> #0:0 (vc1 -> libx264)
     Stream #0:0 -> #0:1 (wmav2 -> libvo_aacenc)
    Press [q] to stop, [?] for help
    frame=   59 fps= 55 q=32.0 size=       0kB time=00:00:00.16 bitrate=   2.3kbits/
    frame=   66 fps= 42 q=31.0 size=       0kB time=00:00:00.40 bitrate=   1.0kbits/
    frame=   75 fps= 35 q=31.0 size=       0kB time=00:00:00.70 bitrate=   0.5kbits/
    frame=   84 fps= 31 q=31.0 size=       0kB time=00:00:01.00 bitrate=   0.4kbits/
    frame=   93 fps= 29 q=31.0 size=       0kB time=00:00:01.30 bitrate=   0.3kbits/
    frame=  102 fps= 27 q=31.0 size=       0kB time=00:00:01.60 bitrate=   0.2kbits/
    frame=  111 fps= 26 q=31.0 size=      38kB time=00:00:01.90 bitrate= 165.1kbits/
    Queue input is backward in time
    [mp4 @ 000000000264f2c0] Non-monotonous DTS in output stream 0:1; previous: 7616
    , current: 7063; changing to 7617. This may result in incorrect timestamps in th
    e output file.
    frame=  120 fps= 25 q=31.0 size=     107kB time=00:00:02.20 bitrate= 397.7kbits/
    frame=  128 fps= 24 q=31.0 size=     161kB time=00:00:02.46 bitrate= 534.1kbits/
    frame=  137 fps= 23 q=31.0 size=     194kB time=00:00:02.76 bitrate= 572.6kbits/
    frame=  145 fps= 23 q=31.0 size=     219kB time=00:00:03.03 bitrate= 592.1kbits/
    frame=  153 fps= 22 q=31.0 size=     273kB time=00:00:03.30 bitrate= 677.8kbits/
    frame=  162 fps= 22 q=31.0 size=     317kB time=00:00:03.60 bitrate= 720.8kbits/
    frame=  170 fps= 21 q=31.0 size=     366kB time=00:00:03.87 bitrate= 775.2kbits/
    frame=  177 fps= 21 q=31.0 size=     451kB time=00:00:04.10 bitrate= 900.2kbits/
    frame=  193 fps= 21 q=31.0 size=     602kB time=00:00:04.63 bitrate=1062.7kbits/
    frame=  208 fps= 22 q=30.0 size=     755kB time=00:00:05.13 bitrate=1204.2kbits/
    frame=  219 fps= 22 q=30.0 size=     769kB time=00:00:05.50 bitrate=1143.6kbits/
    frame=  228 fps= 21 q=30.0 size=     790kB time=00:00:05.80 bitrate=1114.5kbits/
    frame=  234 fps= 21 q=31.0 size=     806kB time=00:00:06.00 bitrate=1098.7kbits/
    frame=  243 fps= 21 q=31.0 size=     806kB time=00:00:06.30 bitrate=1046.4kbits/
    frame=  251 fps= 21 q=31.0 size=     831kB time=00:00:06.57 bitrate=1035.6kbits/
    frame=  260 fps= 20 q=31.0 size=     860kB time=00:00:06.87 bitrate=1024.6kbits/
    frame=  273 fps= 21 q=31.0 size=     934kB time=00:00:07.30 bitrate=1046.7kbits/
    frame=  288 fps= 21 q=30.0 size=    1019kB time=00:00:07.80 bitrate=1068.7kbits/
    frame=  302 fps= 21 q=30.0 size=    1066kB time=00:00:08.27 bitrate=1055.8kbits/
    frame=  314 fps= 21 q=29.0 size=    1146kB time=00:00:08.67 bitrate=1082.1kbits/
    frame=  328 fps= 21 q=28.0 size=    1189kB time=00:00:09.14 bitrate=1065.6kbits/
    frame=  341 fps= 21 q=28.0 size=    1247kB time=00:00:09.57 bitrate=1066.7kbits/
    frame=  352 fps= 22 q=27.0 size=    1274kB time=00:00:09.94 bitrate=1049.3kbits/
    frame=  365 fps= 22 q=27.0 size=    1298kB time=00:00:10.37 bitrate=1024.7kbits/
    frame=  376 fps= 22 q=27.0 size=    1349kB time=00:00:10.74 bitrate=1028.7kbits/
    frame=  388 fps= 22 q=26.0 size=    1378kB time=00:00:11.14 bitrate=1012.9kbits/
    frame=  401 fps= 22 q=26.0 size=    1415kB time=00:00:11.57 bitrate=1001.4kbits/
    frame=  412 fps= 22 q=26.0 size=    1454kB time=00:00:11.94 bitrate= 996.9kbits/
    frame=  421 fps= 22 q=27.0 size=    1489kB time=00:00:12.24 bitrate= 996.2kbits/
    frame=  431 fps= 21 q=27.0 size=    1509kB time=00:00:12.57 bitrate= 982.7kbits/
    frame=  441 fps= 21 q=28.0 size=    1555kB time=00:00:12.91 bitrate= 986.6kbits/
    frame=  450 fps= 21 q=28.0 size=    1599kB time=00:00:13.21 bitrate= 991.7kbits/
    frame=  460 fps= 21 q=28.0 size=    1621kB time=00:00:13.54 bitrate= 980.4kbits/
    frame=  470 fps= 21 q=28.0 size=    1660kB time=00:00:13.88 bitrate= 979.9kbits/
    frame=  480 fps= 21 q=28.0 size=    1734kB time=00:00:14.21 bitrate= 999.2kbits/
    frame=  489 fps= 21 q=29.0 size=    1834kB time=00:00:14.51 bitrate=1035.3kbits/
    frame=  499 fps= 21 q=29.0 size=    1890kB time=00:00:14.84 bitrate=1042.8kbits/
    frame=  508 fps= 21 q=29.0 size=    1962kB time=00:00:15.14 bitrate=1060.8kbits/
    frame=  519 fps= 21 q=29.0 size=    2061kB time=00:00:15.51 bitrate=1087.9kbits/
    frame=  531 fps= 21 q=29.0 size=    2189kB time=00:00:15.91 bitrate=1126.6kbits/
    frame=  540 fps= 21 q=29.0 size=    2329kB time=00:00:16.21 bitrate=1176.4kbits/
    frame=  551 fps= 21 q=29.0 size=    2439kB time=00:00:16.58 bitrate=1204.8kbits/
    frame=  562 fps= 21 q=29.0 size=    2569kB time=00:00:16.95 bitrate=1241.8kbits/
    frame=  575 fps= 21 q=29.0 size=    2688kB time=00:00:17.38 bitrate=1266.9kbits/
    frame=  581 fps= 21 q=29.0 size=    2749kB time=00:00:17.58 bitrate=1280.6kbits/
    frame=  589 fps= 21 q=29.0 size=    2785kB time=00:00:17.85 bitrate=1278.1kbits/
    frame=  595 fps= 21 q=30.0 size=    2808kB time=00:00:18.05 bitrate=1274.5kbits/
    frame=  602 fps= 20 q=30.0 size=    2903kB time=00:00:18.28 bitrate=1300.7kbits/
    frame=  610 fps= 20 q=31.0 size=    3008kB time=00:00:18.55 bitrate=1328.2kbits/
    frame=  616 fps= 20 q=31.0 size=    3128kB time=00:00:18.75 bitrate=1366.6kbits/
    frame=  625 fps= 20 q=31.0 size=    3238kB time=00:00:19.05 bitrate=1392.5kbits/
    frame=  633 fps= 20 q=31.0 size=    3320kB time=00:00:19.31 bitrate=1407.9kbits/
    frame=  642 fps= 20 q=31.0 size=    3397kB time=00:00:19.61 bitrate=1418.4kbits/
    frame=  652 fps= 20 q=31.0 size=    3437kB time=00:00:19.95 bitrate=1411.1kbits/
    frame=  661 fps= 20 q=31.0 size=    3511kB time=00:00:20.25 bitrate=1420.3kbits/
    frame=  669 fps= 20 q=31.0 size=    3578kB time=00:00:20.52 bitrate=1428.2kbits/
    frame=  679 fps= 20 q=31.0 size=    3606kB time=00:00:20.85 bitrate=1416.6kbits/
    frame=  691 fps= 20 q=32.0 size=    3670kB time=00:00:21.25 bitrate=1414.5kbits/
    frame=  701 fps= 20 q=32.0 size=    3798kB time=00:00:21.58 bitrate=1441.2kbits/
    frame=  713 fps= 20 q=32.0 size=    3901kB time=00:00:21.98 bitrate=1453.3kbits/
    frame=  723 fps= 20 q=32.0 size=    3969kB time=00:00:22.32 bitrate=1456.6kbits/
    frame=  735 fps= 20 q=32.0 size=    4027kB time=00:00:22.72 bitrate=1451.7kbits/
    frame=  744 fps= 20 q=32.0 size=    4102kB time=00:00:23.02 bitrate=1459.6kbits/
    frame=  755 fps= 20 q=32.0 size=    4135kB time=00:00:23.39 bitrate=1448.3kbits/
    frame=  764 fps= 20 q=32.0 size=    4172kB time=00:00:23.69 bitrate=1442.7kbits/
    frame=  776 fps= 20 q=32.0 size=    4216kB time=00:00:24.09 bitrate=1433.5kbits/
    frame=  787 fps= 20 q=32.0 size=    4254kB time=00:00:24.45 bitrate=1424.8kbits/
    frame=  802 fps= 20 q=32.0 size=    4337kB time=00:00:24.95 bitrate=1423.6kbits/
    frame=  815 fps= 20 q=32.0 size=    4369kB time=00:00:25.39 bitrate=1409.6kbits/
    frame=  828 fps= 20 q=32.0 size=    4450kB time=00:00:25.82 bitrate=1411.5kbits/
    frame=  840 fps= 20 q=32.0 size=    4467kB time=00:00:26.22 bitrate=1395.3kbits/
    frame=  852 fps= 20 q=32.0 size=    4550kB time=00:00:26.62 bitrate=1399.8kbits/
    frame=  865 fps= 20 q=32.0 size=    4594kB time=00:00:27.06 bitrate=1390.7kbits/
    frame=  877 fps= 20 q=32.0 size=    4629kB time=00:00:27.46 bitrate=1380.9kbits/
    frame=  889 fps= 20 q=32.0 size=    4689kB time=00:00:27.86 bitrate=1378.6kbits/
    frame=  900 fps= 20 q=32.0 size=    4740kB time=00:00:28.22 bitrate=1375.6kbits/
    frame=  901 fps= 19 q=-1.0 Lsize=    5203kB time=00:00:30.10 bitrate=1416.0kbits
    /s
    video:4586kB audio:590kB subtitle:0 global headers:0kB muxing overhead 0.532558%

    [libx264 @ 000000000264faa0] frame I:8     Avg QP:22.98  size: 31700
    [libx264 @ 000000000264faa0] frame P:893   Avg QP:27.55  size:  4974
    [libx264 @ 000000000264faa0] mb I  I16..4: 34.6%  0.0% 65.4%
    [libx264 @ 000000000264faa0] mb P  I16..4:  0.8%  0.0%  1.5%  P16..4: 41.4% 18.8
    %  8.5%  0.0%  0.0%    skip:29.0%
    [libx264 @ 000000000264faa0] final ratefactor: 24.50
    [libx264 @ 000000000264faa0] coded y,uvDC,uvAC intra: 64.3% 76.0% 36.7% inter: 2
    3.5% 19.6% 0.7%
    [libx264 @ 000000000264faa0] i16 v,h,dc,p: 34% 33% 11% 22%
    [libx264 @ 000000000264faa0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 16% 12%  9% 12%
    11% 12%  7%  8%
    [libx264 @ 000000000264faa0] i8c dc,h,v,p: 55% 23% 14%  7%
    [libx264 @ 000000000264faa0] ref P L0: 72.3% 12.0%  8.1%  3.7%  3.9%
    [libx264 @ 000000000264faa0] kb/s:1249.53

    But still no luck. The .mp4 will play in every compatible device/browser combination I have tried except for chrome.. Any advice ?

    TIA.

  • Problem opening xvid264 with avcodec_alloc_context(NULL)

    12 juillet 2024, par user3763774

    I want to multiplex audio and video together using the ffmpeg encoding library with xvid264rgb codec. I can open the codec when I create the context specifying that codec, but not if I use NULL for the argument with allocate context. My understanding is I need to use NULL so I can open the audio codec as well.

    &#xA;

    In the example, the first open works with codec indicated in the allocate context. The second doesn't.

    &#xA;

    #include &#xA;#include &#xA;#include &#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;#define WIDTH 400&#xA;#define HEIGHT 300&#xA;&#xA;const AVCodec *videocodec;&#xA;&#xA;bool init_video_encoder(AVCodecContext *c, int width, int height) {&#xA;    int ret;&#xA;    &#xA;    const AVRational tb_rat = {1, 30};&#xA;    const AVRational fr_rat = {30, 1};&#xA;&#xA;    fprintf(stderr, "init video encoder\n");&#xA;    // video&#xA;    //fprintf(stderr, "speed= %d \n", videocodec->speed);&#xA;    c->bit_rate = 400000;&#xA;    c->width = width;&#xA;    c->height = height;&#xA;    c->time_base = tb_rat;&#xA;    c->framerate = fr_rat;&#xA;    c->gop_size = 10;&#xA;    c->max_b_frames = 1;&#xA;    c->pix_fmt = AV_PIX_FMT_RGB24;&#xA;    if( videocodec->id == AV_CODEC_ID_H264 ) &#xA;        av_opt_set(c->priv_data, "preset", "slow", 0);&#xA;        &#xA;    ret = avcodec_open2(c, videocodec, NULL);&#xA;    if( ret &lt; 0 ) {&#xA;        fprintf(stderr, "failure to open codec: %s\n", av_err2str(ret));&#xA;        return false;&#xA;    }&#xA;    //avcodec_free_context(&amp;c);&#xA;    return true;&#xA;}&#xA;&#xA;int main(int argc, char **argv) {&#xA;&#xA;    AVCodecContext *context = NULL;&#xA;&#xA;    videocodec = avcodec_find_encoder_by_name("libx264rgb");&#xA;    if( videocodec == NULL ) {&#xA;        fprintf(stderr, "video encoder &#x27;libx264rgb&#x27; not found");&#xA;        exit;&#xA;    }&#xA;&#xA;    context = avcodec_alloc_context3(videocodec);&#xA;    if( context == NULL ) {&#xA;        fprintf(stderr, "could not allocate context with codec");&#xA;        return false;&#xA;    }&#xA;    if( init_video_encoder( context, WIDTH, HEIGHT ) ) &#xA;        fprintf(stderr, " success initializing video encoder case one\n");&#xA;    else&#xA;        fprintf(stderr, " failure to initialize video encoder case one\n");&#xA;    avcodec_close( context );&#xA;&#xA;    context = avcodec_alloc_context3(NULL);&#xA;    if( context == NULL ) {&#xA;        fprintf(stderr, "could not allocate context without codec");&#xA;        return false;&#xA;    }&#xA;    if( init_video_encoder( context, WIDTH, HEIGHT ) ) &#xA;        fprintf(stderr, " success initializing video encoder case two\n");&#xA;    else&#xA;        fprintf(stderr, " failure to initialize video encoder case two\n");&#xA;    avcodec_close( context );&#xA;}&#xA;

    &#xA;

    Here is the error message :

    &#xA;

    broken ffmpeg default settings detected&#xA;use an encoding preset (e.g. -vpre medium)&#xA;preset usage: -vpre <speed> -vpre <profile>&#xA;speed presets are listed in x264 --help&#xA;profile is optional; x264 defaults to high&#xA;failure to open codec: Generic error in an external library&#xA;failure to initialize video encoder case two&#xA;</profile></speed>

    &#xA;

    Is this the right approach to use ? How do I set the encoding preset ? The code appears already to do that.

    &#xA;