Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (68)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

Sur d’autres sites (9896)

  • Android : Recording audio in Android and then reading audio into python

    4 février 2017, par Hephaestus

    I need to record audio in an Android application that needs to be imported into Python (ndarray) for plotting and signal processing. It seemed like such a simple idea.
    I started with a simple bit of code for AAC/MPEG4 recording. Recording worked great. I can play it on the Android phone (Nexus 5X) and on a Mac (Quicktime). No problem ! Right ?!? But finding codec/formats that match between Android and Python seems to not be trivial. I’m wondering if the file/codec format written by Android is non-standard and FFMPEG can’t read it.
    If so, what is good audio format/codec that can be written simply in Android and read into an array in Python (2.7.x). Thanks.

    Details :
    Here is an abbreviated form of the android code :

    private final int AUDIO_SAMPLE_RATE = 16000;  
    private final String FILE_EXTENSION = "m4a";  // Audio file extension
    mAbsolutePathFile = workingDir + "/" + mFilename + FILE_EXTENSION;
    mMediaRecording = new MediaRecorder();
    mMediaRecording.setAudioSource (MediaRecorder.AudioSource.MIC);
    mMediaRecording.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    mMediaRecording.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
    mMediaRecording.setAudioSamplingRate(AUDIO_SAMPLE_RATE);
    mMediaRecording.setOutputFile(mAbsolutePathFile);
    mMediaRecording.prepare();
    mMediaRecording.start();

    As I mentioned, the result audio plays nicely in both Android and MacOS, so all seemed well. I did a bit of searching to find a python package for AAC audio and pydub looked like the simplest (I tried audiotools, but couldn’t find sample code). To install pydub, I followed the instructions :

    pip install pydub

    and

    brew install libav --with-libvorbis --with-sdl --with-theora

    and

    brew install ffmpeg --with-libvorbis --with-ffplay --with-theora

    Following the discussions (here), i tested ffmpeg and it does execute from the command line :

     $ffmpeg
     ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
     built with Apple LLVM version 8.0.0 (clang-800.0.42.1)

    But when I try to read the file using Python :

    import pydub
    pydub.AudioSegment.from_file("sensorlog_2017-02-03_12-50-25-345_Dev26c5_Loc27_TypeAUDIO.m4a", "aac")

    I get :

    Traceback (most recent call last):
     File "...anaconda2/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2881, in run_code
       exec(code_obj, self.user_global_ns, self.user_ns)
     File "", line 1, in <module>
    pydub.AudioSegment.from_file("sensorlog_2017-02-03_12-50-25-345_Dev26c5_Loc27_TypeAUDIO.m4a", "aac")
    File ".../anaconda2/lib/python2.7/site-packages/pydub/audio_segment.py", line 472, in from_file
       raise CouldntDecodeError("Decoding failed. ffmpeg returned error code: {0}\n\nOutput from ffmpeg/avlib:\n\n{1}".format(p.returncode, p_err))
    CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1
    Output from ffmpeg/avlib:
    avconv version 11.4, Copyright (c) 2000-2014 the Libav developers
     built on Feb  3 2017 12:09:15 with Apple LLVM version 8.0.0 (clang-800.0.42.1)
    [aac @ 0x7ff30001cc00] get_buffer() failed
    [aac @ 0x7ff30001cc00] channel element 3.14 is not allocated
    [aac @ 0x7ff30001cc00] Sample rate index in program config element does not match the sample rate index configured by the container.
    [aac @ 0x7ff30001cc00] Input buffer exhausted before END element found
    [aac @ 0x7ff30001cc00] More than one AAC RDB per ADTS frame is not implemented. Update your Libav version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
    [aac @ 0x7ff30001cc00] Error decoding AAC frame header.
    [aac @ 0x7ff300001000] Could not find codec parameters (Audio: aac, 4.0, fltp, 213 kb/s)
    [aac @ 0x7ff300001000] Estimating duration from bitrate, this may be inaccurate
    /var/folders/cm/1r6x6rbj7hn_51qvfjzj7nx80000gn/T/tmps7b8Gf: could not find codec parameters
    </module>

    In summary, is this a conflict between Android and FFMPEG ? Should I use a different codec/format ? Should I use a different Python Audio library ?
    Thanks.

  • fluent ffmpeg size output option not working

    19 janvier 2017, par Ashbury

    Summary : I’m trying to limit output to 3mb, .outputOptions('-fs 3000000') isn’t working for me, the file is coming back with a size of 119260428 or 119mb.

    Here is the code to try for yourself, all you need is a test.mp3 large enough that the resulting testoutput.ogg is > 3mb :

    var ffmpeg = require("fluent-ffmpeg");
    var command = ffmpeg();

    var convertToOGG = function(){
     var fileName = 'test.mp3'

     ffmpeg.ffprobe(fileName, function(err, metadata) {
       command
         .input(fileName)
         .inputFormat("mp3")
         .audioChannels(1)
         .outputOptions('-fs', 3000000)
         .output('testoutput.ogg')
         .on("progress", function(progress) {
           console.log("Processing: " + progress.timemark);
         })
         .on("error", function(err, stdout, stderr) {
           console.log("Cannot process video: " + err.message);
         })
         .on("end", function(stdout, stderr) {
           ffmpeg.ffprobe('testoutput.ogg', function(err,metadata){
             if(metadata.format.size >= 3000000){

               console.log("didn't work")
             }
           })
         })
       .run();
     });
    };

    convertToOGG();

    Per the fluent-ffmpeg documentation you should be able to use a ffmpeg command in an output option : outputOption()

    This method allows passing any output-related option to ffmpeg. You can call it with a single argument to pass a single option, optionnaly
    with a space-separated parameter :

    /* Single option */
    ffmpeg('/path/to/file.avi').outputOptions('-someOption');

    and in FFMPEG’s documentation :

    -fs limit_size (output) Set the file size limit, expressed in bytes. No further chunk of bytes is written after the limit is exceeded. The
    size of the output file is slightly more than the requested file size.

    It’s giving me no errors, just seemingly ignoring the file size limit of 99mb and outputting a 119.3mb file.

    Edit - Looks like -fs 3000000 is working for mp3 to wav, but still wont do mp3 to ogg. This is the output from running the command in terminal :

    ✗ ffmpeg -i test.mp3 -fs 3000000 testoutput.ogg
    ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
     built with Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
     libavutil      55. 34.100 / 55. 34.100
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.100 / 57. 56.100
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    [mp3 @ 0x7fc6a4000000] Estimating duration from bitrate, this may be inaccurate
    Input #0, mp3, from 'test.mp3':
     Metadata:
       lyrics-eng      : xxx
       title           : xxx
       artist          : xxx
       album_artist    : xxx
       album           : xxx
       genre           : xxx
     Duration: 03:27:28.74, start: 0.000000, bitrate: 128 kb/s
       Stream #0:0: Audio: mp3, 44100 Hz, mono, s16p, 128 kb/s
       Stream #0:1: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 540x360, 90k tbr, 90k tbn, 90k tbc
       Metadata:
         title           : Array
         comment         : Cover (front)
    [swscaler @ 0x7fc6a4808800] deprecated pixel format used, make sure you did set range correctly
    [ogg @ 0x7fc6a3815800] Frame rate very high for a muxer not efficiently supporting it.
    Please consider specifying a lower framerate, a different muxer or -vsync 2
    Output #0, ogg, to 'testoutput.ogg':
     Metadata:
       lyrics-eng      : xxx
       title           : xxx
       artist          : xxx
       album_artist    : xxx
       album           : xxx
       genre           : xxx
       encoder         : Lavf57.56.100
       Stream #0:0: Video: theora (libtheora), yuv444p, 540x360, q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tbc
       Metadata:
         title           : Array
         DESCRIPTION     : Cover (front)
         encoder         : Lavc57.64.101 libtheora
         lyrics-eng      : xxx
         artist          : xxx
         ALBUMARTIST     : xxx
         album           : xxx
         genre           : xxx
       Stream #0:1: Audio: vorbis (libvorbis), 44100 Hz, mono, fltp
       Metadata:
         encoder         : Lavc57.64.101 libvorbis
         lyrics-eng      : xxx
         title           : xxx
         artist          : xxx
         ALBUMARTIST     : xxx
         album           : xxx
         genre           : xxx
    Stream mapping:
     Stream #0:1 -> #0:0 (mjpeg (native) -> theora (libtheora))
     Stream #0:0 -> #0:1 (mp3 (native) -> vorbis (libvorbis))
    Press [q] to stop, [?] for help
    frame=    1 fps=0.0 q=-0.0 Lsize=  116465kB time=03:27:28.71 bitrate=  76.6kbits/s speed=61.2x
    video:9kB audio:114907kB subtitle:0kB other streams:0kB global headers:6kB muxing overhead: 1.347787%
  • ffmpeg and nvidia acceleration, need better results

    25 août 2022, par Stephan

    I've been trying to figure out the best way to use the nvenc hardware acceleration in ffmpeg to convert some older, larger avi files to MP4. My issue is the default x264 settings generate a good file size with settings that don't seem to replicate when you use the h264_nvenc codec.

    &#xA;

    First we have the original AVI...

    &#xA;

    General&#xA;Complete name                            : input.avi&#xA;Format                                   : AVI&#xA;Format/Info                              : Audio Video Interleave&#xA;Format profile                           : OpenDML&#xA;File size                                : 1.55 GiB&#xA;Duration                                 : 2 h 14 min&#xA;Overall bit rate                         : 1 643 kb/s&#xA;Writing application                      : Lavf52.91.0&#xA;&#xA;Video&#xA;ID                                       : 0&#xA;Format                                   : MPEG-4 Visual&#xA;Format profile                           : Simple@L1&#xA;Format settings, BVOP                    : No&#xA;Format settings, QPel                    : No&#xA;Format settings, GMC                     : No warppoints&#xA;Format settings, Matrix                  : Default (H.263)&#xA;Codec ID                                 : FMP4&#xA;Duration                                 : 2 h 14 min&#xA;Bit rate                                 : 1 500 kb/s&#xA;Width                                    : 640 pixels&#xA;Height                                   : 480 pixels&#xA;Display aspect ratio                     : 4:3&#xA;Frame rate                               : 29.970 (30000/1001) FPS&#xA;Color space                              : YUV&#xA;Chroma subsampling                       : 4:2:0&#xA;Bit depth                                : 8 bits&#xA;Scan type                                : Progressive&#xA;Compression mode                         : Lossy&#xA;Bits/(Pixel*Frame)                       : 0.163&#xA;Stream size                              : 1.41 GiB (91%)&#xA;Writing library                          : Lavc52.101.0&#xA;&#xA;Audio&#xA;ID                                       : 1&#xA;Format                                   : MPEG Audio&#xA;Format version                           : Version 1&#xA;Format profile                           : Layer 3&#xA;Format settings                          : Joint stereo / MS Stereo&#xA;Codec ID                                 : 55&#xA;Codec ID/Hint                            : MP3&#xA;Duration                                 : 2 h 14 min&#xA;Bit rate mode                            : Constant&#xA;Bit rate                                 : 128 kb/s&#xA;Channel(s)                               : 2 channels&#xA;Sampling rate                            : 44.1 kHz&#xA;Compression mode                         : Lossy&#xA;Stream size                              : 124 MiB (8%)&#xA;Alignment                                : Aligned on interleaves&#xA;Interleave, duration                     : 26  ms (0.78 video frame)&#xA;

    &#xA;

    If we use the default x264 settings and no hardware acceleration for encoding

    &#xA;

    ffmpeg.exe -i .\input.avi  -c:v libx264 -c:a aac "output x264.mp4"&#xA;

    &#xA;

    General&#xA;Complete name                            : output x264.mp4&#xA;Format                                   : MPEG-4&#xA;Format profile                           : Base Media&#xA;Codec ID                                 : isom (isom/iso2/avc1/mp41)&#xA;File size                                : 886 MiB&#xA;Duration                                 : 2 h 14 min&#xA;Overall bit rate                         : 918 kb/s&#xA;Writing application                      : Lavf59.27.100&#xA;&#xA;Video&#xA;ID                                       : 1&#xA;Format                                   : AVC&#xA;Format/Info                              : Advanced Video Codec&#xA;Format profile                           : High@L3&#xA;Format settings                          : CABAC / 4 Ref Frames&#xA;Format settings, CABAC                   : Yes&#xA;Format settings, Reference frames        : 4 frames&#xA;Codec ID                                 : avc1&#xA;Codec ID/Info                            : Advanced Video Coding&#xA;Duration                                 : 2 h 14 min&#xA;Bit rate                                 : 780 kb/s&#xA;Width                                    : 640 pixels&#xA;Height                                   : 480 pixels&#xA;Display aspect ratio                     : 4:3&#xA;Frame rate mode                          : Constant&#xA;Frame rate                               : 29.970 (30000/1001) FPS&#xA;Color space                              : YUV&#xA;Chroma subsampling                       : 4:2:0&#xA;Bit depth                                : 8 bits&#xA;Scan type                                : Progressive&#xA;Bits/(Pixel*Frame)                       : 0.085&#xA;Stream size                              : 753 MiB (85%)&#xA;Writing library                          : x264 core 164 r3095 baee400&#xA;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=12 / lookahead_threads=2 / 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&#xA;Codec configuration box                  : avcC&#xA;&#xA;Audio&#xA;ID                                       : 2&#xA;Format                                   : AAC LC&#xA;Format/Info                              : Advanced Audio Codec Low Complexity&#xA;Codec ID                                 : mp4a-40-2&#xA;Duration                                 : 2 h 14 min&#xA;Source duration                          : 2 h 14 min&#xA;Source_Duration_LastFrame                : -17 ms&#xA;Bit rate mode                            : Constant&#xA;Bit rate                                 : 132 kb/s&#xA;Channel(s)                               : 2 channels&#xA;Channel layout                           : L R&#xA;Sampling rate                            : 44.1 kHz&#xA;Frame rate                               : 43.066 FPS (1024 SPF)&#xA;Compression mode                         : Lossy&#xA;Stream size                              : 126 MiB (14%)&#xA;Source stream size                       : 126 MiB (14%)&#xA;Default                                  : Yes&#xA;Alternate group                          : 1&#xA;

    &#xA;

    Then we try with default h264_nvenc codec and the file is larger than the original, but also noticing there are different default encoding settings.

    &#xA;

    ffmpeg.exe -hwaccel auto -i .\input.avi  -c:v h264_nvenc -c:a aac "output x264 nvenc.mp4"&#xA;

    &#xA;

    General&#xA;Complete name                            : output x264 nvenc.mp4&#xA;Format                                   : MPEG-4&#xA;Format profile                           : Base Media&#xA;Codec ID                                 : isom (isom/iso2/avc1/mp41)&#xA;File size                                : 2.01 GiB&#xA;Duration                                 : 2 h 14 min&#xA;Overall bit rate mode                    : Variable&#xA;Overall bit rate                         : 2 134 kb/s&#xA;Writing application                      : Lavf58.29.100&#xA;&#xA;Video&#xA;ID                                       : 1&#xA;Format                                   : AVC&#xA;Format/Info                              : Advanced Video Codec&#xA;Format profile                           : High@L3&#xA;Format settings                          : CABAC / 1 Ref Frames&#xA;Format settings, CABAC                   : Yes&#xA;Format settings, Reference frames        : 1 frame&#xA;Codec ID                                 : avc1&#xA;Codec ID/Info                            : Advanced Video Coding&#xA;Duration                                 : 2 h 14 min&#xA;Bit rate mode                            : Variable&#xA;Bit rate                                 : 1 999 kb/s&#xA;Maximum bit rate                         : 6 000 kb/s&#xA;Width                                    : 640 pixels&#xA;Height                                   : 480 pixels&#xA;Display aspect ratio                     : 4:3&#xA;Frame rate mode                          : Constant&#xA;Frame rate                               : 29.970 (30000/1001) FPS&#xA;Color space                              : YUV&#xA;Chroma subsampling                       : 4:2:0&#xA;Bit depth                                : 8 bits&#xA;Scan type                                : Progressive&#xA;Bits/(Pixel*Frame)                       : 0.217&#xA;Stream size                              : 1.88 GiB (94%)&#xA;Codec configuration box                  : avcC&#xA;&#xA;Audio&#xA;ID                                       : 2&#xA;Format                                   : AAC LC&#xA;Format/Info                              : Advanced Audio Codec Low Complexity&#xA;Codec ID                                 : mp4a-40-2&#xA;Duration                                 : 2 h 14 min&#xA;Duration_LastFrame                       : -17 ms&#xA;Bit rate mode                            : Constant&#xA;Bit rate                                 : 129 kb/s&#xA;Channel(s)                               : 2 channels&#xA;Channel layout                           : L R&#xA;Sampling rate                            : 44.1 kHz&#xA;Frame rate                               : 43.066 FPS (1024 SPF)&#xA;Compression mode                         : Lossy&#xA;Stream size                              : 124 MiB (6%)&#xA;Default                                  : Yes&#xA;Alternate group                          : 1&#xA;

    &#xA;

    So the question is how can I get the same results (or better) while using the acceleration from nvidia codecs ? My GPU can decode this file around 600 FPS, where as the CPU on standard x264 is under 100 FPS.

    &#xA;