
Recherche avancée
Autres articles (27)
-
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (4964)
-
How to compensate frame rate underrun while muxing video to mp4 container with libav
17 septembre 2021, par Nuno SantosI have a process that generates video frames in real time. I’m muxing the generated video frames stream in a video file (x264 codec on a mp4 container).


I'm using ffmpeg-libav and I'm basing myself on the muxing.c example. The problem with the example is that isn't a real world scenario as frames are being generated on a while loop for a given stream duration, never missing a frame.


On my program, frames are supposed to be generated at FPS, however, depending on the hardware capacity it might produce less than FPS. When I initialize the video stream context I declare that frame rate is FPS :


AVRational r = { 1, FPS };
ost->st->time_base = r;



This specifies that the video is going to have FPS frame rate but if less frames are produced, the playback will be faster because it will still reproduce the video as it if had all the declared frames per second.


After googling a lot about this topic I understand that the key to fix this is to manipulate pts and dts but I still haven't found a solution that works.


There are two key functions when writing video frames in the muxing.c example, routines that I'm using in my program :


AVFrame* get_video_frame(int timestamp, OutputStream *ost, const QImage &image)
{
 /* when we pass a frame to the encoder, it may keep a reference to it
 * internally; make sure we do not overwrite it here */
 if (av_frame_make_writable(ost->frame) < 0)
 exit(1);

 av_image_fill_arrays(ost->tmp_frame->data, ost->tmp_frame->linesize, image.bits(), AV_PIX_FMT_RGBA, ost->frame->width, ost->frame->height, 8);
 libyuv::ABGRToI420(ost->tmp_frame->data[0], ost->tmp_frame->linesize[0], ost->frame->data[0], ost->frame->linesize[0], ost->frame->data[1], ost->frame->linesize[1], ost->frame->data[2], ost->frame->linesize[2], ost->tmp_frame->width, -ost->tmp_frame->height);

 #if 1 // this is my attempt to rescale pts, but crashes with ptsframe->pts = av_rescale_q(timestamp, AVRational{1, 1000}, ost->st->time_base);
 #else
 ost->frame->pts = ost->next_pts++;
 #endif

 return ost->frame;
}



On the original code, the pts is simply an incremeting integer for each frame. What I'm trying to do is to pass a timestamp in ms since the beggining of the recording so that I can rescale the pts. When I rescale pts the program crashes complaining that pts is lower then dts.


From what I've been reading, the pts/dts manipulation is supposed to be done at the packet level so I have also tried to manipulate things on write_frame routine without success.


int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c, AVStream *st, AVFrame *frame)
{
 int ret;

 // send the frame to the encoder
 ret = avcodec_send_frame(c, frame);

 if (ret<0)
 {
 fprintf(stderr, "Error sending a frame to the encoder\n");
 exit(1);
 }

 while (ret >= 0)
 {
 AVPacket pkt = { 0 };

 ret = avcodec_receive_packet(c, &pkt);

 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
 {
 break;
 }
 else if (ret<0)
 {
 //fprintf(stderr, "Error encoding a frame: %s\n", av_err2str(ret));
 exit(1);
 }

 /* rescale output packet timestamp values from codec to stream timebase */
 av_packet_rescale_ts(&pkt, c->time_base, st->time_base);
 pkt.stream_index = st->index;

 /* Write the compressed frame to the media file. */
 //log_packet(fmt_ctx, &pkt);
 ret = av_interleaved_write_frame(fmt_ctx, &pkt);
 av_packet_unref(&pkt);

 if (ret < 0)
 {
 //fprintf(stderr, "Error while writing output packet: %s\n", av_err2str(ret));
 exit(1);
 }
 }

 return ret == AVERROR_EOF ? 1 : 0;
}



How should I manipulate dts and pts so that I can achieve a video at certain frame that does not have all the frames as specified in the stream initialization ? Where should I do that manipulation ? On get_video_frame ? On write_frame ? On both ?


Am I heading in the right direction ? What am I missing ?


-
The Ultimate Guide to HeatMap Software
-
The Mystery of the No such file or directory exception
22 avril 2022, par JohnWickNo idea what's going on here. Set a breakpoint after the for of loop in the following function. temp/concat.txt exists but the following exception is thrown :




Uncaught Error Error : ffmpeg exited with code 1 : temp/concat.txt : No
such file or directory




Outputting stderr gives a bit more info :




[concat @ 000001e2e30124c0] Impossible to open
'temp/concat.txt#voiceover #funny #fall #lol.mp4' index.js:19
temp/concat.txt : No such file or directory




And here is the contents of concat.txt, standard ffmpeg concat demuxer format :


file '#voiceover #funny #fall #lol.mp4'
file 'part 2 repost 🙄 #fyp #funny @jordond262 @princemoonjq add my snap heroicdw333.mp4'
file 'This is my hair wet wet WOAHHH #GrowUpWithMe #fyp #foryoupage #love #funny #puppy #goldenretriever #cute #dog #wetwet.mp4'
file 'POV calling your friends when your 90#FootlongShuffle #GhostMode #funny #grandma #fyp #halloween #collegegotmelike #tiktok #foryoupage.mp4'
file 'Sam Ki Singing Kaisi Lgi 😂😜 insta-samayranarula #foryou #trending #lockdown #queen_samayra #tiktokindia #funny #gharbaithoindia 🏠 #comedyindia.mp4'
file 'Reply to @juswa646 #fyp#funny #relatable.mp4'
file 'RaNdOm ViDeOs! #fy #fypシ #viral #meme #funny #xyzbca #funnyvideos #randomvideo.mp4'
file 'Reply to @bratzdoll.maya what should I do next 🙄 #fyp #foryoupage #leethe4th #memes #tall #funny #lol.mp4'
file 'Part 2 #fyp #foryou #viral #foryoupageofficiall #funny #trending.mp4'
file 'Lmfao 😂 (via @danibreezy01) #lmao #lmfao #funny #cousins #family #fyp #foryou #foryoupage.mp4'
file 'When you are a clumsy kitty #trend #joke #Khaleesi #funny #kittensoftiktok #foryou #fyp #foryoupage #cute #catsoftiktok.mp4'
file 'Tag That Friend That Always Be Falling Asleep 😂 #foryou #funny #fail #nap #sleep #pennsylvania #SHEINcares #viral #trending #meme #memes #foryoupage.mp4'
file '#funny #funnyvideos #girlfriend #crzy #Birdshit.mp4'
file 'He forgot he was a dog. #dog #fyp #talkingdog #cute #pet #funny.mp4'
file 'Bad Day #part1 #badday #falling #funny #memes #viral #jokes #comedy #trending #fyp #foryou #share #likes #us #uk #xyzbca #epic #pourtoi #fail #wee.mp4'
file 'I think he got offended ( #catsoftiktok #fyp #funny #catlover #MyJob #yellow #foryoupage.mp4'
file 'They took OFF today 🐶🤠🐶 #joshbutlertv #roxyandremi #funny #comedy #dogs #viral #memes.mp4'
file 'Had to make sure momma was there #funny #fyp #raccoons #love #bff #foryoupage #ThisorThatSBLV.mp4'
file 'That\'s not how you get out... #mysterymakers #escaperoom #foryou #fyp #crazystory #friends #funny #crazy #teammate.mp4'



The function throwing the exception.


async function makeCompilation(paths, outPath) {
 for (const filePath of paths) {
 await fs.appendFile(
 "temp/concat.txt",
 `file '${path.basename(filePath).replace("'", "\\'")}'${os.EOL}`
 );
 }
 return new Promise((resolve, reject) => {
 ffmpeg("temp/concat.txt")
 .inputOptions(["-f concat", "-safe 0"])
 .outputOption("-c copy")
 .on("stderr", (line) => console.log(line))
 .on("end", async () => {
 await fs.rm("temp/concat.txt");
 resolve();
 })
 .save(outPath);
 });
}