
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 (34)
-
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 ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
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 (9258)
-
How to record frames with ffmpeg and finish the recording
20 février 2024, par Jorge Augusto WilchenIn the following code, i trying to create a class to record frames from an IP camera (RTSP), save frames on a .avi file and finish the record, but, when i kill the operation, the video file may be corrupted. Have any other more safely way to stop the ffmpeg recording ?


.cpp file :


#include "videorecorder.h"


VideoRecorder::VideoRecorder(const std::string& rtspUrl) :
 url(rtspUrl),
 recording(false)
{

}

VideoRecorder::~VideoRecorder()
{
 end_record();
}

bool VideoRecorder::start_record(const std::string &fileName)
{
 if (recording) {
 std::cerr << "Already recording." << std::endl;
 return false;
 }

 std::string command = "ffmpeg -rtsp_transport udp -i " + url
 + " -c:v mjpeg -preset fast -qp 0 " + fileName;

 videoWriter = popen(command.c_str(), "w");
 if (!videoWriter) {
 std::cerr << "Error opening ffmpeg process." << std::endl;
 return false;
 }

 recording = true;
 ffmpegProcessId = getpid();
 std::cout << "Recording started." << std::endl;
 return true;
}

bool VideoRecorder::end_record()
{
 if (recording) {
 if (videoWriter) {
 pid_t ffmpegPID = fileno(videoWriter);

 if (kill(ffmpegPID, SIGTERM) == 0) {
 std::cout << "Recording terminated successfully." << std::endl;
 } else {
 std::cerr << "Error terminating recording." << std::endl;
 return false;
 }

 int status = pclose(videoWriter);

 if (status == 0) {
 std::cout << "Recording ended successfully." << std::endl;
 } else {
 std::cerr << "Error ending recording. pclose status: " << status << std::endl;
 return false;
 }
 } else {
 std::cerr << "Error ending recording. videoWriter is nullptr." << std::endl;
 return false;
 }

 recording = false;
 return true;
 }

 return false;
}



.h file :


#ifndef VIDEORECORDER_H
#define VIDEORECORDER_H

#include <string>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <csignal>
#include <sys></sys>wait.h>

extern "C" {
#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libavutil></libavutil>avutil.h>
#include <libavutil></libavutil>opt.h>
#include <libswscale></libswscale>swscale.h>
#include 
}

#include <linux></linux>videodev2.h>

#include <opencv2></opencv2>opencv.hpp>
#include <opencv2></opencv2>videoio.hpp>
#include <opencv2></opencv2>highgui/highgui.hpp>


class VideoRecorder
{
public:
 VideoRecorder(const std::string& rtspUrl);
 ~VideoRecorder();
 bool start_record(const std::string& fileName);
 bool end_record();

private:
 std::string url;
 AVFormatContext *formatContext;
 AVStream *videoStream;
 AVCodecContext *codecContext;
 AVCodec *codec;
 SwsContext *swsContext;
 AVFrame *frame;
 AVPacket packet;
 bool recording;
 pid_t ffmpegProcessId;
 FILE* videoWriter;
};

#endif // VIDEORECORDER_H
</csignal></cstdlib></fstream></iostream></string>


I'm using the ffmpeg lib becouse i need max speed on frames recording, and OpenCV and AV Lib is much slowness than ffmpeg.


This my terminal output after recording during 10 seconds (generated a file with 23 seconds duration) :


Recording started.
ffmpeg version 4.3.6-0+deb11u1+rpt5 Copyright (c) 2000-2023 the FFmpeg developers
 built with gcc 10 (Debian 10.2.1-6)
 configuration: --prefix=/usr --extra-version=0+deb11u1+rpt5 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-mmal --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --enable-sand --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Input #0, rtsp, from 'rtsp://admin:[password]@[ip]:[port]/live/0/MAIN':
 Metadata:
 title : RTSP Server
 Duration: N/A, start: 0.280000, bitrate: N/A
 Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1920x1080, 25 fps, 25 tbr, 90k tbn, 50 tbc
Codec AVOption preset (Configuration preset) specified for output file #0 (/home/guardian-tech/Pictures/output_frame.avi) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption qp (Constant quantization parameter rate control method) specified for output file #0 (/home/guardian-tech/Pictures/output_frame.avi) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
Output #0, avi, to '/home/guardian-tech/Pictures/output_frame.avi':
 Metadata:
 INAM : RTSP Server
 ISFT : Lavf58.45.100
 Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p(pc), 1920x1080, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
 Metadata:
 encoder : Lavc58.91.100 mjpeg
 Side data:
 cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[rtsp @ 0x5592e7bb00] max delay reached. need to consume packet
[rtsp @ 0x5592e7bb00] RTP: missed 212 packets
[h264 @ 0x5592ebb790] concealing 2192 DC, 2192 AC, 2192 MV errors in I frame
rtsp://admin:[password]@[ip]:[port]/live/0/MAIN: corrupt decoded frame in stream 0
[rtsp @ 0x5592e7bb00] max delay reached. need to consume packet
[rtsp @ 0x5592e7bb00] RTP: missed 6 packets
[rtsp @ 0x5592e7bb00] max delay reached. need to consume packet
[rtsp @ 0x5592e7bb00] RTP: missed 14 packets
[h264 @ 0x5592f1bd30] cabac decode of qscale diff failed at 42 29
[h264 @ 0x5592f1bd30] error while decoding MB 42 29, bytestream 0
[h264 @ 0x5592f1bd30] concealing 4687 DC, 4687 AC, 4687 MV errors in I frame
rtsp://admin:[password]@[ip]:[port]/live/0/MAIN: corrupt decoded frame in stream 0
Error terminating recording.



-
Android record video from multiple cameras and composite the multiple videos into one video
22 mars 2024, par tonySilverAndroid Camera2 records video from multiple cameras, adds real-time timestamps to the frames captured by each camera, and finally composites the multiple videos into a single video file. does Android's native interface support these features ? Do I have to user FFMPEG to handle the frames captured by each camera


-
how to record screen of windows using ffmpeg inside WSL [closed]
12 avril 2024, par SanthoshI have WSL2 and ubuntu installed inside it.


I have ffmpeg command line installed inside it.


Now I am not sure how to record the screen. Can someone help me what command options to be used to record screen (including windows UI)


I tried the below command.


Opened powershell in windows, then entered into wsl and then ran the below command


ffmpeg -f x11grab -y -framerate 30 -s 1920x1080 -i :0.0 -c:v libx264 -preset superfast -crf 18 out.mp4



but it results in blank screen video