
Recherche avancée
Médias (91)
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Core Media Video
4 avril 2013, par
Mis à jour : Juin 2013
Langue : français
Type : Video
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (55)
-
Participer à sa traduction
10 avril 2011Vous 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 (...) -
L’utiliser, en parler, le critiquer
10 avril 2011La première attitude à adopter est d’en parler, soit directement avec les personnes impliquées dans son développement, soit autour de vous pour convaincre de nouvelles personnes à l’utiliser.
Plus la communauté sera nombreuse et plus les évolutions seront rapides ...
Une liste de discussion est disponible pour tout échange entre utilisateurs. -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (10088)
-
C++ ffmpeg lib version 7.0 - runtime error
1er septembre 2024, par Chris PI want to make a C++ lib named cppdub which will mimic the python module pydub.


One main function is to export the AudioSegment to a file with a specific format (example : mp3).


The code is :


void check_av_error(int error_code, const std::string& msg) {
 if (error_code < 0) {
 char errbuf[AV_ERROR_MAX_STRING_SIZE];
 av_strerror(error_code, errbuf, sizeof(errbuf));
 throw std::runtime_error(msg + ": " + errbuf);
 }
}

std::string av_err2str_(int errnum) {
 char buf[AV_ERROR_MAX_STRING_SIZE];
 av_strerror(errnum, buf, sizeof(buf));
 return std::string(buf);
}

void log_error(const std::string& msg) {
 std::cerr << "Error: " << msg << std::endl;
}

std::ofstream cppdub::AudioSegment::export_segment(
 std::string& out_f,
 const std::string& format,
 const std::string& codec,
 const std::string& bitrate,
 const std::vector& parameters,
 const std::map& tags,
 const std::string& id3v2_version,
 const std::string& cover) {

 av_log_set_level(AV_LOG_DEBUG);
 avformat_network_init();

 AVFormatContext* format_ctx = nullptr;
 int ret = avformat_alloc_output_context2(&format_ctx, nullptr, format.c_str(), out_f.c_str());
 check_av_error(ret, "Could not allocate format context");

 if (!(format_ctx->oformat->flags & AVFMT_NOFILE)) {
 ret = avio_open(&format_ctx->pb, out_f.c_str(), AVIO_FLAG_WRITE);
 check_av_error(ret, "Could not open output file");
 }

 AVStream* stream = avformat_new_stream(format_ctx, nullptr);
 if (!stream) {
 avformat_free_context(format_ctx);
 throw std::runtime_error("Could not allocate stream");
 }

 const AVCodec* codec_obj = avcodec_find_encoder_by_name(codec.c_str());
 if (!codec_obj) {
 avformat_free_context(format_ctx);
 throw std::runtime_error("Codec not found");
 }

 AVCodecContext* codec_ctx = avcodec_alloc_context3(codec_obj);
 if (!codec_ctx) {
 avformat_free_context(format_ctx);
 throw std::runtime_error("Could not allocate codec context");
 }

 codec_ctx->sample_rate = this->get_frame_rate();
 AVChannelLayout ch_layout_1;
 av_channel_layout_uninit(&ch_layout_1);
 av_channel_layout_default(&ch_layout_1, 2);
 codec_ctx->ch_layout = ch_layout_1; // Adjust based on your needs
 codec_ctx->bit_rate = std::stoi(bitrate);
 codec_ctx->sample_fmt = codec_obj->sample_fmts[0];

 if (format_ctx->oformat->flags & AVFMT_GLOBALHEADER) {
 codec_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
 }

 ret = avcodec_open2(codec_ctx, codec_obj, nullptr);
 check_av_error(ret, "Could not open codec");

 stream->time_base = { 1, codec_ctx->sample_rate };
 ret = avcodec_parameters_from_context(stream->codecpar, codec_ctx);
 check_av_error(ret, "Could not set codec parameters");

 ret = avformat_write_header(format_ctx, nullptr);
 check_av_error(ret, "Error occurred when writing header");

 AVPacket pkt;
 av_init_packet(&pkt);
 pkt.data = nullptr;
 pkt.size = 0;

 int frame_size = av_samples_get_buffer_size(nullptr, codec_ctx->ch_layout.nb_channels,
 codec_ctx->frame_size, codec_ctx->sample_fmt, 0);
 check_av_error(frame_size, "Could not calculate frame size");

 AVFrame* frame = av_frame_alloc();
 if (!frame) {
 avcodec_free_context(&codec_ctx);
 avformat_free_context(format_ctx);
 throw std::runtime_error("Error allocating frame");
 }

 frame->format = codec_ctx->sample_fmt;
 frame->ch_layout = codec_ctx->ch_layout;
 frame->sample_rate = codec_ctx->sample_rate;
 frame->nb_samples = codec_ctx->frame_size;

 ret = av_frame_get_buffer(frame, 0);
 if (ret < 0) {
 av_frame_free(&frame);
 avcodec_free_context(&codec_ctx);
 avformat_free_context(format_ctx);
 throw std::runtime_error("Error allocating frame buffer: " + av_err2str_(ret));
 }

 size_t data_offset = 0;

 while (data_offset < this->raw_data().size()) {
 int samples_to_process = std::min(frame_size, static_cast<int>(this->raw_data().size()) - static_cast<int>(data_offset));

 // Fill the frame with audio data
 ret = avcodec_fill_audio_frame(frame, codec_ctx->ch_layout.nb_channels, codec_ctx->sample_fmt,
 reinterpret_cast<const>(this->raw_data().data()) + data_offset,
 samples_to_process, 0);
 if (ret < 0) {
 log_error("Error filling audio frame: " + av_err2str_(ret));
 av_frame_free(&frame);
 avcodec_free_context(&codec_ctx);
 avformat_free_context(format_ctx);
 throw std::runtime_error("Error filling audio frame: " + av_err2str_(ret));
 }

 data_offset += samples_to_process;

 ret = avcodec_send_frame(codec_ctx, frame);
 if (ret < 0) {
 log_error("Error sending frame for encoding: " + av_err2str_(ret));
 av_frame_free(&frame);
 avcodec_free_context(&codec_ctx);
 avformat_free_context(format_ctx);
 throw std::runtime_error("Error sending frame for encoding: " + av_err2str_(ret));
 }

 while (ret >= 0) {
 ret = avcodec_receive_packet(codec_ctx, &pkt);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
 break;
 }
 check_av_error(ret, "Error receiving packet");

 pkt.stream_index = stream->index;

 ret = av_interleaved_write_frame(format_ctx, &pkt);
 check_av_error(ret, "Error writing encoded frame to output file");

 av_packet_unref(&pkt);
 }
 }

 // Flush the encoder
 avcodec_send_frame(codec_ctx, nullptr);
 while (avcodec_receive_packet(codec_ctx, &pkt) == 0) {
 pkt.stream_index = stream->index;
 av_interleaved_write_frame(format_ctx, &pkt);
 av_packet_unref(&pkt);
 }

 av_write_trailer(format_ctx);

 av_frame_free(&frame);
 avcodec_free_context(&codec_ctx);
 avformat_free_context(format_ctx);

 return std::ofstream(out_f, std::ios::binary);
}
</const></int></int>


The runtime error is :


Exception thrown at 0x00007FF945137C9B (avcodec-61.dll) in cppdub_test.exe : 0xC0000005 : Access violation reading location 0x0000024CBCD25080.


for line :


ret = avcodec_send_frame(codec_ctx, frame);



Call stack :


avcodec-61.dll!00007ff945137c9b() Unknown
 avcodec-61.dll!00007ff9451381bb() Unknown
 avcodec-61.dll!00007ff945139679() Unknown
 avcodec-61.dll!00007ff94371521d() Unknown
 avcodec-61.dll!00007ff9434a80c2() Unknown
 avcodec-61.dll!00007ff9434a84a6() Unknown
 avcodec-61.dll!00007ff9434a8749() Unknown
> cppdub_test.exe!cppdub::AudioSegment::export_segment(std::string & out_f, const std::string & format, const std::string & codec, const std::string & bitrate, const std::vector> & parameters, const std::map,std::allocator>> & tags, const std::string & id3v2_version, const std::string & cover) Line 572 C++
 cppdub_test.exe!main() Line 33 C++
 [External Code] 




Autos :


+ this 0x000000d3a08ff690 {data_="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0... ...} cppdub::AudioSegment *
+ bitrate "128000" const std::string &
+ ch_layout_1 {order=AV_CHANNEL_ORDER_NATIVE (1) nb_channels=2 u={mask=3 map=0x0000000000000003 {id=??? name=... opaque=...} } ...} AVChannelLayout
+ codec "libmp3lame" const std::string &
+ codec_ctx 0x0000024cbc78c240 {av_class=avcodec-61.dll!0x00007ff94789c760 {class_name=0x00007ff94789c740 "AVCodecContext" ...} ...} AVCodecContext *
+ codec_obj avcodec-61.dll!0x00007ff9477fa4c0 (load symbols for additional information) {name=0x00007ff9477fa47c "libmp3lame" ...} const AVCodec *
+ cover "" const std::string &
 data_offset 9216 unsigned __int64
+ format "mp3" const std::string &
+ format_ctx 0x0000024cbc788a40 {av_class=avformat-61.dll!0x00007ff99eb09fe0 {class_name=0x00007ff99eb09fc0 "AVFormatContext" ...} ...} AVFormatContext *
+ frame 0x0000024cbc787380 {data=0x0000024cbc787380 {0x0000024cbcd25080 <error reading="reading" characters="characters" of="of">, ...} ...} AVFrame *
 frame_size 9216 int
+ id3v2_version "4" const std::string &
+ out_f "ha-ha-ha.mp3" std::string &
+ parameters { size=0 } const std::vector> &
+ pkt {buf=0x0000000000000000 <null> pts=-9223372036854775808 dts=-9223372036854775808 ...} AVPacket
 ret 9216 int
 samples_to_process 9216 int
+ stream 0x0000024cbc789bc0 {av_class=avformat-61.dll!0x00007ff99eb09840 {class_name=0x00007ff99eb09820 "AVStream" ...} ...} AVStream *
+ tags { size=0 } const std::map,std::allocator>> &
</null></error>


-
Revision 37648 : On pouvait toujours courir derrière ce bug ... si on n’utilise pas le bon ...
25 avril 2010, par kent1@… — LogOn pouvait toujours courir derrière ce bug ... si on n’utilise pas le bon argument…
-
bash loop through list of file paths - characters get removed when sending to ffmpeg [duplicate]
9 octobre 2018, par Brad JohnsonThis question already has an answer here :
I have a text file that contains a list of paths to flac files I want to convert to wav. Here is a small section of it :
/mnt/nfs/Music/Rob D/1995 - Clubbed To Death/Rob D - 02 - Clubbed To Death _Kurayamino Variation_.flac
/mnt/nfs/Music/Blonde Redhead/2000 - Melody of Certain Damaged Lemons/11 - For the Damaged Coda.flac
/mnt/nfs/Music/I Monster/2001 - Daydream In Blue/01 - Daydream In Blue.flac
/mnt/nfs/Music/Moby/2002 - Extreme Ways/01 - Extreme Ways.flac
/mnt/nfs/Music/RJD2/2002 - Deadringer/01 - The Horror.flac
/mnt/nfs/Music/RJD2/2002 - Deadringer/03 - Smoke & Mirrors.flac
/mnt/nfs/Music/RJD2/2002 - Deadringer/06 - Ghostwriter.flac
/mnt/nfs/Music/RJD2/2002 - Deadringer/10 - Chicken-Bone Circuit.flac
/mnt/nfs/Music/FC Kahuna/2003 - Hayling/01 - Hayling _Original_.flac
/mnt/nfs/Music/Lamb/2003 - Between Darkness and Wonder/04 - Angelica.flacI’m trying to loop through it like so :
while read -r line; do
wavfile=$(basename "$line")
wavfile="${wavfile%.*}"
ffmpeg -i "$line" "$2/$wavfile.wav"
done <$1...where $1 is where I would pass the name of the text file and $2 is the destination directory.
Here is the output with the irrelevant ffmpeg junk pruned out :
Input #0, flac, from '/mnt/nfs/Music/Rob D/1995 - Clubbed To Death/Rob D - 02 - Clubbed To Death _Kurayamino Variation_.flac':
...
Output #0, wav, to '/mnt/gray/Clubbed To Death/Rob D - 02 - Clubbed To Death _Kurayamino Variation_.wav':
...
/nfs/Music/Blonde Redhead/2000 - Melody of Certain Damaged Lemons/11 - For the Damaged Coda.flac: No such file or directory
...
Input #0, flac, from '/mnt/nfs/Music/I Monster/2001 - Daydream In Blue/01 - Daydream In Blue.flac':
...
Output #0, wav, to '/mnt/gray/Clubbed To Death/01 - Daydream In Blue.wav':
...
nt/nfs/Music/Moby/2002 - Extreme Ways/01 - Extreme Ways.flac: No such file or directory
...
Input #0, flac, from '/mnt/nfs/Music/RJD2/2002 - Deadringer/01 - The Horror.flac':
...
Output #0, wav, to '/mnt/gray/Clubbed To Death/01 - The Horror.wav':
...
nt/nfs/Music/RJD2/2002 - Deadringer/03 - Smoke & Mirrors.flac: No such file or directory
...
Input #0, flac, from '/mnt/nfs/Music/RJD2/2002 - Deadringer/06 - Ghostwriter.flac':
...
Output #0, wav, to '/mnt/gray/Clubbed To Death/06 - Ghostwriter.wav':
...
nt/nfs/Music/RJD2/2002 - Deadringer/10 - Chicken-Bone Circuit.flac: No such file or directory
...
Input #0, flac, from '/mnt/nfs/Music/FC Kahuna/2003 - Hayling/01 - Hayling _Original_.flac':
...
Output #0, wav, to '/mnt/gray/Clubbed To Death/01 - Hayling _Original_.wav':
...
/nfs/Music/Lamb/2003 - Between Darkness and Wonder/04 - Angelica.flac: No such file or directoryIf you pay attention to the paths that ffmpeg reports don’t exist, you’ll see that a seemingly random number of characters has been removed from the beginning. This appears to happen on even numbered lines, but odd numbered lines work. I can only reproduce this behavior when using ffmpeg. If I replace the ffmpeg line with a simple echo statement, every file path is shown to be correct. How can this be ?
Other suggestions of accomplishing this are also welcome, however I do need the files processed in the order by which I have them listed in the file.