
Recherche avancée
Autres articles (105)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (21383)
-
AWS Lambda and Fluent FFMPEG error "cannot read property "isStream" of undefined"
29 mai 2021, par Travis Leeso here's the goal : convert a .webm file hosted in an S3 into a gif and upload that to a new bucket. This all works fine when run locally, but when trying to translate it into a lambda, fluent-ffmpeg throws errors when it runs the command.


Here's the code snippet :


ffmpeg(new URL(vid))
 .outputOptions("-vf", "scale=320:-1:flags=lanczos,fps=14")
 .on('progress', () => {
 console.log('progress');
 })
 .on('end', () => {
 //Do stuff with the result when it is done
 })
 .output(newKey)
 .run(newKey);



in this snippet, "vid" is a presigned GET url for an S3 bucket containing the .webm video file, and "newKey" is the name of the new bucket (and a temporary writeStream/File that is created in the lambda to store the new .gif file until we upload it to S3 - not super relevant to this issue).


What should happen (and does locally) is that a new output is created containing the converted .gif file


What happens when it is deployed in a lambda is that it reaches the .outputOptions call and throws a type error saying that it cannot read property isStream of undefined.


At first glance, this seems like I simply don't have FFMPEG installed in the lambda, but I do. I have tried with the prebuilt layer using NodeJS 10 found here : https://serverlessrepo.aws.amazon.com/applications/us-east-1/145266761615/ffmpeg-lambda-layer ,
with a NodeJS 12 layer that was built by some engineers here previously, and tried building a NodeJS 14 FFMPEG layer myself and using that. I tried for all three using no configuration and letting it call the PATH ffmpeg, using the FFMPEG_PATH and FFPROBE_PATH environment variables set to either what was specified in the previous layers, or what I made it in the newly built one, and even manually setting the path to the executables using the setFfmpegPath and setFfprobePath functions found on the fluent-ffmpeg object.


Lastly, I even tried bundling the executables in with the actual lambda code itself and uploading it through an S3, trying all three above methods of getting it to point to the correct paths once again to no avail.


I'm seriously in need of help if anyone else has encountered something similar or just might know what is going on. I'm at wit's end here trying to figure this out.


-
How do you suppress "Error in the pull function" messages to stdout ?
23 mai 2021, par Vincent LinI am working on making my Discord bot into a music player using youtube-dl. I got past the common problem of music being interrupted from an "Error in the pull function" by having ffmpeg reconnect upon this error. However, I cannot figure out how to suppress the error messages being sent to stdout anyway :


[tls @ 0000023ea3564e80] Error in the pull function.
[https @ 0000023ea3560d80] Will reconnect at 327680 in 0 second(s), error=I/O error.



My ytdl options and ffmpeg options are as follows :


YTDL_OPTIONS = \
{"format": "bestaudio",
 "noplaylist": True,
 "quiet": True}
FFMPEG_OPTIONS = \
{"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5",
 "options": "-vn"}



I experimented with various YTDL options like
"no_warnings": False
,"debug_printtraffic": False
,"progress_hooks": []
, etc. However, none of these additions worked. To be honest, I don't even know the source of these messages (youtube-dl or discord.py itself). Is there a way to suppress these messages ?

-
"Critical error detected c0000374" when running av_packet_unref or av_frame_unref
15 mai 2021, par Shivang SharmaI am trying to read and decode frames which is happening nicely but when its reaching part of un-referencing frame or packet using
av_packet_unref
andav_frame_unref
it is giving error during second frame or third frame sometimes .

Error (Copied from visual studio output window) :


Critical error detected c0000374
Libav.exe has triggered a breakpoint



Here is some code of reading and decoding which is giving error :


void Decoder::streamNextFrame(int type = 0)
{
 while (av_read_frame(this->fileFormatCtx, this->latestpacket) >= 0) {
 if (this->audioDecoder->activeAudioStream != nullptr) {
 if (this->latestpacket->stream_index == this->audioDecoder->activeAudioStream->index) {
 avcodec_send_packet(this->audioDecoder->activeStreamDecoder, this->latestpacket);
 err = avcodec_receive_frame(this->audioDecoder->activeStreamDecoder, this->decodedFrame);
 if (err == AVERROR(EAGAIN)) {
 av_frame_unref(this->decodedFrame);
 av_packet_unref(this->latestpacket);
 continue;
 }

 {
 int currentIndex = (int)this->audioFrames->size();
 this->audioFrames->resize((int)this->audioFrames->size() + 1);
 int nb = 0;
 this->audioFrames->at(currentIndex).pts = (int)this->decodedFrame->pts;
 if (this->audioDecoder->activeStreamDecoder->sample_fmt != AV_SAMPLE_FMT_S16) {
 nb = 2048 * this->audioDecoder->activeStreamDecoder->channels;
 printf("%i\n", nb);
 this->audioFrames->at(currentIndex).data.resize(nb);
 if (!swr_is_initialized(swr)) {

 swr_alloc_set_opts(swr, this->audioDecoder->activeStreamDecoder->channel_layout, AV_SAMPLE_FMT_S16, this->audioDecoder->activeStreamDecoder->sample_rate, this->audioDecoder->activeStreamDecoder->channel_layout, this->audioDecoder->activeStreamDecoder->sample_fmt, this->audioDecoder->activeStreamDecoder->sample_rate, 0, nullptr);
 swr_init(swr);
 }

 uint8_t* buffer = this->audioFrames->at(currentIndex).data.data();
 swr_convert(swr, &buffer, nb, (const uint8_t**)this->decodedFrame->extended_data, this->decodedFrame->nb_samples);
 }
 else {
 nb = this->decodedFrame->nb_samples * this->audioDecoder->activeStreamDecoder->channels;
 this->audioFrames->at(currentIndex).data = std::vector(*this->decodedFrame->extended_data, *this->decodedFrame->extended_data + (uint8_t)nb);
 }

 this->audioFrames->at(currentIndex).buffersize = nb;
 }

 if (err == AVERROR_EOF) {
 this->audioDecoder->streamEnded = true;
 av_frame_unref(this->decodedFrame);
 av_packet_unref(this->latestpacket);
 break;
 }
 else if (err >= 0) {
 this->audioDecoder->streamEnded = false;
 }

 if (type != 0) {
 av_packet_unref(this->latestpacket);
 av_frame_unref(this->decodedFrame);
 break;
 }
 av_packet_unref(this->latestpacket);
 av_frame_unref(this->decodedFrame);
 }
 }
 else {
 printf("No active audio stream is set\n");
 if(type!=0)
 break;
 }
 }

}



I have removed some of code which was concerning the video and was not giving problem I think.


Some Information about above code :


this->audioFrames is a pointer to vector with following type.
std::vector<audioframeformat>* "AudioFrameFormat" is struct defined as following

struct AudioFrameFormat {
 std::vector data = {};
 int pts = 0;
 int buffersize = 0;
 };


swr is a private class member allocated in constructor
</audioframeformat>


Call Stack looks like :




I am getting from call stack is that I am not taking care of my heap memory.


Can someone please explain where problem is and, why some times it run till third frame and some time till second frame of the audio stream ?


And please tell how can I improve this code.