Recherche avancée

Médias (0)

Mot : - Tags -/objet éditorial

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

Autres articles (36)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (5062)

  • how to cut audio file and merge with video file in android ?

    23 octobre 2017, par Mayank Sugandhi

    I want to cut audio and merge an audio file with video programmatically in android.

    I don’t know how to work with FFMPEG , can anyone tell me how to start with or another solution ?

    Any Help ?

  • FFMPEG command to combine a WAV file and a video file ?

    18 janvier 2013, par ALexF

    I use Qt & OpenCV to record video and QAudioInput to record audio into wav format. I want to combine them into one video file. How can I accomplish this ? I have researched so much but I can't seem to find a command to accomplish this.

    I use both Windows and Mac.

  • I want to take any Audio from a file and encode it as PCM_ALAW. My Example is a .m4a file to .wav file

    22 novembre 2023, par Clockman

    I have been working on this for a while now while am generally new to ffmpeg library, I have studied it a bit. The challenge I have that at the point of witting to file I get the following exception.

    


    "Exception thrown at 0x00007FFACA8305B3 (avformat-60.dll) in FfmpegPractice.exe : 0xC0000005 : Access violation writing location 0x0000000000000000.". I understand this means am writing to an uninitialized buffer am unable to discover why this is happening. The exception call stack shows the following

    


    avformat-60.dll!avformat_write_header() C
avformat-60.dll!ff_write_chained()  C
avformat-60.dll!ff_write_chained()  C
avformat-60.dll!av_write_frame()    C
FfmpegPractice.exe!main() Line 215  C++


    


    Some things I have tried

    


    This code is part of a larger project built with CMake but for some reason I could no step into ffmpeg library while debugging, So I recompiled ffmpeg ensured debugging was enabled so I could drill down to the root cause but I still could not step into the ffmpeg library.

    


    I then created a minimal project using visual studio c++ console project and I still could not step into the code.

    


    I have read through many ffmpeg docs and some I could find on the internet and I still could not solve it.

    


    This is the code

    


    #include <iostream>&#xA;&#xA;extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswresample></libswresample>swresample.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libavutil></libavutil>audio_fifo.h>&#xA;}&#xA;&#xA;using namespace std;&#xA;&#xA;//in audio file&#xA;string filename{ "rapid_caller_test.m4a" };&#xA;AVFormatContext* pFormatCtx{};&#xA;AVCodecContext* pCodecCtx{};&#xA;AVStream* pStream{};&#xA;&#xA;//out audio file&#xA;string outFilename{ "output.wav" };&#xA;AVFormatContext* pOutFormatCtx{ nullptr };&#xA;AVCodecContext* pOutCodecCtx{ nullptr };&#xA;AVIOContext* pOutIoContext{ nullptr };&#xA;const AVCodec* pOutCodec{ nullptr };&#xA;AVStream* pOutStream{ nullptr };&#xA;const int OUTPUT_CHANNELS = 1;&#xA;const int SAMPLE_RATE = 8000;&#xA;const int OUT_BIT_RATE = 64000;&#xA;uint8_t** convertedSamplesBuffer{ nullptr };&#xA;int64_t dstNmbrSamples{ 0 };&#xA;int dstLineSize{ 0 };&#xA;static int64_t pts{ 0 };&#xA;&#xA;//conversion context;&#xA;SwrContext* swr{};&#xA;&#xA;uint32_t i{ 0 };&#xA;int audiostream{ -1 };&#xA;&#xA;&#xA;void cleanUp() &#xA;{&#xA;  avcodec_free_context(&amp;pOutCodecCtx);;&#xA;  avio_closep(&amp;(pOutFormatCtx)->pb);&#xA;  avformat_free_context(pOutFormatCtx);&#xA;  pOutFormatCtx = nullptr;&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;&#xA;/*&#xA;* section to setup input file&#xA;*/&#xA;if (avformat_open_input(&amp;pFormatCtx, filename.data(), nullptr, nullptr) != 0) {&#xA;  cout &lt;&lt; "could not open file " &lt;&lt; filename &lt;&lt; endl;&#xA;  return -1;&#xA;}&#xA;if (avformat_find_stream_info(pFormatCtx, nullptr) &lt; 0) {&#xA;  cout &lt;&lt; "Could not retrieve stream information from file " &lt;&lt; filename &lt;&lt; endl;&#xA;  return -1;&#xA;}&#xA;av_dump_format(pFormatCtx, 0, filename.c_str(), 0);&#xA;&#xA;for (i = 0; i &lt; pFormatCtx->nb_streams; i&#x2B;&#x2B;) {&#xA;  if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {&#xA;    audiostream = i;&#xA;    break;&#xA;  }&#xA;}&#xA;if (audiostream == -1) {&#xA;  cout &lt;&lt; "did not find audio stream" &lt;&lt; endl;&#xA;  return -1;&#xA;}&#xA;&#xA;pStream = pFormatCtx->streams[audiostream];&#xA;const AVCodec* pCodec{ avcodec_find_decoder(pStream->codecpar->codec_id) };&#xA;pCodecCtx = avcodec_alloc_context3(pCodec);&#xA;avcodec_parameters_to_context(pCodecCtx, pStream->codecpar);&#xA;if (avcodec_open2(pCodecCtx, pCodec, nullptr)) {&#xA;  cout &lt;&lt; "could not open codec" &lt;&lt; endl;&#xA;  return -1;&#xA;}&#xA;&#xA;/*&#xA;* section to set up output file which is a G711 audio&#xA;*/&#xA;if (avio_open(&amp;pOutIoContext, outFilename.data(), AVIO_FLAG_WRITE)) {&#xA;  cout &lt;&lt; "could not open out put file" &lt;&lt; endl;&#xA;  return -1;&#xA;}&#xA;if (!(pOutFormatCtx = avformat_alloc_context())) {&#xA;  cout &lt;&lt; "could not create format conext" &lt;&lt; endl;&#xA;  cleanUp();&#xA;  return -1;&#xA;}&#xA;pOutFormatCtx->pb = pOutIoContext;&#xA;if (!(pOutFormatCtx->oformat = av_guess_format(nullptr, outFilename.data(), nullptr))) {&#xA;  cout &lt;&lt; "could not find output file format" &lt;&lt; endl;&#xA;  cleanUp();&#xA;  return -1;&#xA;}&#xA;if (!(pOutFormatCtx->url = av_strdup(outFilename.data()))) {&#xA;  cout &lt;&lt; "could not allocate file name" &lt;&lt; endl;&#xA;  cleanUp();&#xA;  return -1;&#xA;}&#xA;if (!(pOutCodec = avcodec_find_encoder(AV_CODEC_ID_PCM_ALAW))) {&#xA;  cout &lt;&lt; "codec not found" &lt;&lt; endl;&#xA;  cleanUp();&#xA;  return -1;&#xA;}&#xA;if (!(pOutStream = avformat_new_stream(pOutFormatCtx, nullptr))) {&#xA;  cout &lt;&lt; "could not create new stream" &lt;&lt; endl;&#xA;  cleanUp();&#xA;  return -1;&#xA;}&#xA;if (!(pOutCodecCtx = avcodec_alloc_context3(pOutCodec))) {&#xA;  cout &lt;&lt; "could not allocate codec context" &lt;&lt; endl;&#xA;  return -1;&#xA;}&#xA;av_channel_layout_default(&amp;pOutCodecCtx->ch_layout, OUTPUT_CHANNELS);&#xA;pOutCodecCtx->sample_rate = SAMPLE_RATE;&#xA;pOutCodecCtx->sample_fmt = pOutCodec->sample_fmts[0];&#xA;pOutCodecCtx->bit_rate = OUT_BIT_RATE;&#xA;&#xA;//setting sample rate for the container&#xA;pOutStream->time_base.den = SAMPLE_RATE;&#xA;pOutStream->time_base.num = 1;&#xA;if (pOutFormatCtx->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;  pOutCodecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;if (avcodec_open2(pOutCodecCtx, pOutCodec, nullptr)) {&#xA;  cout &lt;&lt; "could not open output codec" &lt;&lt; endl;&#xA;  cleanUp();&#xA;  return -1;&#xA;}&#xA;if ((avcodec_parameters_from_context(pOutStream->codecpar, pOutCodecCtx)) &lt; 0) {&#xA;  cout &lt;&lt; "could not initialize stream parameters" &lt;&lt; endl;&#xA;}   &#xA;&#xA;AVPacket* packet = av_packet_alloc();&#xA;&#xA;swr = swr_alloc();&#xA;swr_alloc_set_opts2(&amp;swr, &amp;pOutCodecCtx->ch_layout, pOutCodecCtx->sample_fmt, pOutCodecCtx->sample_rate,&amp;pCodecCtx->ch_layout, pCodecCtx->sample_fmt, pCodecCtx->sample_rate, 0, nullptr);&#xA;swr_init(swr);&#xA;&#xA;int ret{};&#xA;int bSize{};&#xA;while (av_read_frame(pFormatCtx, packet) >= 0) {&#xA;  AVFrame* pFrame = av_frame_alloc();&#xA;  AVFrame* pOutFrame = av_frame_alloc();&#xA;  if (packet->stream_index == audiostream) {&#xA;    ret = avcodec_send_packet(pCodecCtx, packet);&#xA;    while (ret >= 0) {&#xA;    ret = avcodec_receive_frame(pCodecCtx, pFrame);&#xA;    if (ret == AVERROR(EAGAIN))&#xA;    continue;&#xA;    else if (ret == AVERROR_EOF)&#xA;    break;&#xA;    dstNmbrSamples = av_rescale_rnd(swr_get_delay(swr, pCodecCtx->sample_rate) &#x2B; pFrame->nb_samples, pOutCodecCtx->sample_rate, pCodecCtx->sample_rate, AV_ROUND_UP);&#xA;    if ((av_samples_alloc_array_and_samples(&amp;convertedSamplesBuffer, &amp;dstLineSize, pOutCodecCtx->ch_layout.nb_channels,dstNmbrSamples, pOutCodecCtx->sample_fmt, 0)) &lt; 0) {&#xA;    cout &lt;&lt; "coult not allocate samples array and buffer" &lt;&lt; endl;&#xA;    }&#xA;    int channel_samples_count{ 0 };&#xA;    channel_samples_count = swr_convert(swr, convertedSamplesBuffer, dstNmbrSamples, (const uint8_t**)pFrame->data, pFrame->nb_samples);&#xA;    bSize = av_samples_get_buffer_size(&amp;dstLineSize, pOutCodecCtx->ch_layout.nb_channels, channel_samples_count, pOutCodecCtx->sample_fmt, 0);&#xA;    cout &lt;&lt; "no of samples is " &lt;&lt; channel_samples_count &lt;&lt; " the buffer size " &lt;&lt; bSize &lt;&lt; endl;&#xA;    pOutFrame->nb_samples = channel_samples_count;&#xA;    av_channel_layout_copy(&amp;pOutFrame->ch_layout, &amp;pOutCodecCtx->ch_layout);&#xA;    pOutFrame->format = pOutCodecCtx->sample_fmt;&#xA;    pOutFrame->sample_rate = pOutCodecCtx->sample_rate;&#xA;    if ((av_frame_get_buffer(pOutFrame, 0)) &lt; 0) {&#xA;    cout &lt;&lt; "could not allocate output frame samples " &lt;&lt; endl;&#xA;    av_frame_free(&amp;pOutFrame);&#xA;  }&#xA;                &#xA;    //populate out frame buffer&#xA;    av_frame_make_writable(pOutFrame);&#xA;    for (int i{ 0 }; i &lt; bSize; i&#x2B;&#x2B;) {&#xA;    pOutFrame->data[0][i] = convertedSamplesBuffer[0][i];&#xA;    cout &lt;&lt; pOutFrame->data[0][i];&#xA;   }&#xA;   if (pOutFrame) {&#xA;   pOutFrame->pts = pts;&#xA;   pts &#x2B;= pOutFrame->nb_samples;&#xA;  }&#xA;   int res = avcodec_send_frame(pOutCodecCtx, pOutFrame);&#xA;    if (res &lt; 0) {&#xA;    cout &lt;&lt; "error sending frame to encoder" &lt;&lt; endl;&#xA;    cleanUp();&#xA;    return -1;&#xA;   }&#xA;   //int er = avformat_write_header(pOutFormatCtx,nullptr);&#xA;   AVPacket* pOutPacket = av_packet_alloc();&#xA;   pOutPacket->time_base.num = 1;&#xA;   pOutPacket->time_base.den = 8000;&#xA;   if (pOutPacket == nullptr) {&#xA;    cout &lt;&lt; "unable to allocate packet" &lt;&lt; endl;&#xA;  }&#xA;  while (res >= 0) {&#xA;   res = avcodec_receive_packet(pOutCodecCtx, pOutPacket);&#xA;   if (res == AVERROR(EAGAIN))&#xA;    continue;&#xA;   else if (ret == AVERROR_EOF)&#xA;    break;&#xA;   av_packet_rescale_ts(pOutPacket, pOutCodecCtx->time_base, pOutFormatCtx->streams[0]->time_base);&#xA;   //av_dump_format(pOutFormatCtx, 0, outFilename.c_str(), 1);&#xA;   if (av_write_frame(pOutFormatCtx, pOutPacket) &lt; 0) {&#xA;    cout &lt;&lt; "could not write frame" &lt;&lt; endl;&#xA;    }&#xA;   }&#xA;  }&#xA;}&#xA; av_frame_free(&amp;pFrame);&#xA; av_frame_free(&amp;pOutFrame);&#xA;}&#xA;if (av_write_trailer(pOutFormatCtx) &lt; 0) {&#xA; cout &lt;&lt; "could not write file trailer" &lt;&lt; endl;&#xA;}&#xA;swr_free(&amp;swr);&#xA;avcodec_free_context(&amp;pOutCodecCtx);&#xA;av_packet_free(&amp;packet);&#xA;}&#xA;</iostream>

    &#xA;

    Error/Exception

    &#xA;

    The exception is thrown when I call

    &#xA;

    if (av_write_frame(pOutFormatCtx, pOutPacket) &lt; 0)  {   cout &lt;&lt; "could not write frame" &lt;&lt; endl; } &#xA;I also called this line

    &#xA;

    //int er = avformat_write_header(pOutFormatCtx,nullptr);

    &#xA;

    to see if I will get an exception but it did not throw any exception.

    &#xA;

    I have spent weeks on this issue with no success.&#xA;My goal is to take any audio from a file an be able to resample it if need be, and transcode it to PCM_ALAW.&#xA;I will appreciate any help I can get.

    &#xA;