Recherche avancée

Médias (39)

Mot : - Tags -/audio

Autres articles (93)

Sur d’autres sites (16719)

  • Why does not work audio element currentTime on ffmpeg encoded mp3 file in Chrome browser

    25 juillet 2013, par Peter

    I have an HTML5 audio element :

    <audio preload="auto">
       <source src="./Sound/recording.mp3" type="audio/mpeg">
    </source></audio>

    and I need to be able to play last 4 seconds from mp3 recording. My javaScript is :

    audio.currentTime = audio.duration-4;
    audio.play();

    Works ok in IE10 and Firefox, but Chrome starts playing from a wrong place. The difference between reported audio.currentTime and actual playback position is about 20s. The recording.mp3 is created with ffmpeg :

    ffmpeg -i recording.wav -ab 32k recording.mp3

    It works, when I strip the ID3v2 header from the recording.mp3 (deleting the first couple bytes in the file before the audio data).

    It also works when I compress to ogg. Can somebody point me to the right direction (ffmpeg switches, audio element attributes or whatever) to get it work also in chrome ?

    Thanks in advance

  • Is there a chance to check why a videostream on IOS does not work ?

    13 septembre 2013, par mazleu

    I have a very strange problem.

    To stream videos I use AMS (Adobe Media Server)
    This works fine for the most Videos.
    But 4 videos do not work on iOS devices. The first seconds work but then the Video break.
    All Videos (over 1000) are convertet with the same ffmpeg settings.

    I try other settings and other converters but the Result are the same.

    Is there any opportunity to show why IOS don't like this 4 Videos ?

    Mediainfo form a failed video :

    MediaInfoLib - v0.7.62

    General
    Complete name                       : ---
    Format                              : MPEG-4
    Format profile                      : Base Media
    Codec ID                            : isom
    File size                           : 91.3 MiB
    Duration                            : 24mn 27s
    Overall bit rate mode               : Variable
    Overall bit rate                    : 522 Kbps
    Encoded date                        : UTC 2013-09-12 14:24:13
    Tagged date                         : UTC 2013-09-12 14:24:13

    Video
    ID                                  : 1
    Format                              : AVC
    Format/Info                         : Advanced Video Codec
    Format profile                      : High@L4.1
    Format settings, CABAC              : Yes
    Format settings, ReFrames           : 4 frames
    Codec ID                            : avc1
    Codec ID/Info                       : Advanced Video Coding
    Duration                            : 24mn 27s
    Bit rate                            : 387 Kbps
    Maximum bit rate                    : 4 885 Kbps
    Width                               : 1 280 pixels
    Height                              : 720 pixels
    Display aspect ratio                : 16:9
    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.014
    Stream size                         : 67.7 MiB (74%)
    Writing library                     : x264 core 130 r2273 b3065e6
    Encoding settings                   : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / 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=6 / 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=1 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=crf / mbtree=1 / crf=28.0 / qcomp=0.70 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=50000 / vbv_bufsize=50000 / crf_max=0.0 / nal_hrd=none / ip_ratio=1.40 / aq=1:0.60
    Encoded date                        : UTC 2013-09-12 14:24:13
    Tagged date                         : UTC 2013-09-12 14:24:16

    Audio
    ID                                  : 2
    Format                              : AAC
    Format/Info                         : Advanced Audio Codec
    Format profile                      : LC
    Codec ID                            : 40
    Duration                            : 24mn 27s
    Bit rate mode                       : Variable
    Bit rate                            : 132 Kbps
    Maximum bit rate                    : 172 Kbps
    Channel(s)                          : 2 channels
    Channel positions                   : Front: L R
    Sampling rate                       : 48.0 KHz
    Compression mode                    : Lossy
    Delay relative to video             : 67ms
    Stream size                         : 22.7 MiB (25%)
    Encoded date                        : UTC 2013-09-12 14:24:15
    Tagged date                         : UTC 2013-09-12 14:24:16
  • FFMPEG Reading audio from memory doesn't work

    2 février 2021, par Tobi Akinyemi

    When I try to instantiate this struct, my program crashes :

    &#xA;

    struct MemoryAVFormat {&#xA;    MemoryAVFormat(const MemoryAVFormat &amp;) = delete;&#xA;&#xA;    AVFormatContext *ctx;&#xA;    AVIOContext *ioCtx;&#xA;&#xA;    MemoryAVFormat(char *audio, size_t audio_length) :&#xA;            ctx(avformat_alloc_context()),&#xA;            ioCtx(create_audio_buffer_io_context(audio, audio_length)) {&#xA;&#xA;        if (ctx == nullptr)&#xA;            throw audio_processing_exception("Failed to allocate context");&#xA;&#xA;        if (ioCtx == nullptr)&#xA;            throw audio_processing_exception("Failed to allocate IO context for audio buffer");&#xA;&#xA;        ctx->pb = ioCtx;&#xA;        ctx->flags |= AVFMT_FLAG_CUSTOM_IO;&#xA;&#xA;        int err = avformat_open_input(&amp;ctx, "nullptr", NULL, NULL);&#xA;        if (err != 0)&#xA;            throwAvError("Error configuring context from audio buffer", err);&#xA;    }&#xA;&#xA;    AVIOContext *create_audio_buffer_io_context(char *audio, size_t audio_length) const {&#xA;        return avio_alloc_context(reinterpret_cast<unsigned char="char">(audio),&#xA;                                  audio_length,&#xA;                                  0,&#xA;                                  audio,&#xA;                                  [](void *, uint8_t *, int buf_size) { return buf_size; },&#xA;                                  NULL,&#xA;                                  NULL);&#xA;    }&#xA;&#xA;    ~MemoryAVFormat() {&#xA;        av_free(ioCtx);&#xA;        avformat_close_input(&amp;ctx);&#xA;    }&#xA;}&#xA;</unsigned>

    &#xA;

    I've read and tried every single tutorial on doing this and none of them work

    &#xA;

    Has anyone got this working before ?

    &#xA;

    crashes on the line : int err = avformat_open_input(&amp;ctx, "nullptr", NULL, NULL);

    &#xA;