
Recherche avancée
Autres articles (44)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
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 ) (...)
Sur d’autres sites (7509)
-
Catching dropped FFMPEG frames in iOS ?
30 juin 2020, par jbeu425I'm developing an iOS app which streams RTSP over a WiFi connection. I need to be able to inform the user if the connection is not good, and I'd like to know if there is some way to catch dropped FFMPEG frames in some way ?


My frames are decoded using the method below, is there somewhere here I can tap into to catch an issue with the frame being decoded ? There is currently an NSLog which says "decode video error !" about half way down this method, but running network link conditioner set to "very poor network" never reaches this line even though the stream is very choppy.


All I'm after really is some sort of line that I can breakpoint when the stream loses quality because of a bad connection.


- (NSArray *) decodeFrames: (CGFloat) minDuration
{
NSMutableArray *result = [NSMutableArray array];

@synchronized (lock) {
 
 if([_reading integerValue] != 1){
 
 _reading = [NSNumber numberWithInt:1];
 
 @synchronized (_seekPosition) {
 if([_seekPosition integerValue] != -1 && _seekPosition){
 [self seekDecoder:[_seekPosition longLongValue]];
 _seekPosition = [NSNumber numberWithInt:-1];
 }
 }
 
 if (_videoStream == -1 &&
 _audioStream == -1)
 return nil;
 
 AVPacket packet;
 
 CGFloat decodedDuration = 0;
 
 CGFloat totalDuration = [TimeHelper calculateTimeDifference];
 CGFloat timeStampAtEntry = av_frame_get_best_effort_timestamp(_videoFrame) * _videoTimeBase;
 NSDate *timeAtEntry = [NSDate date];
 BOOL catchUp = totalDuration > 0;
 do {
 BOOL finished = NO;
 
 while (!finished) {
 
 NSDate* snap1 = [NSDate date];
 if (av_read_frame(_formatCtx, &packet) < 0) {
 _isEOF = YES;
 catchUp = NO;
 [self endOfFileReached];
 break;
 }
 
 [self frameRead];
 
 if ([[NSDate date] timeIntervalSinceDate:snap1] > 3) {
 _isEOF = YES;
 catchUp = NO;
 [self endOfFileReached];
 break;
 }
 if (packet.stream_index ==_videoStream) {
 
 int pktSize = packet.size;
 

 while (pktSize > 0) {
 
 int gotframe = 0;
 int len = avcodec_decode_video2(_videoCodecCtx,
 _videoFrame,
 &gotframe,
 &packet);
 
 if (len < 0) {
 LoggerVideo(0, @"decode video error, skip packet");
 NSLog(@"decode video error!");
 break;
 }
 
 if (gotframe) {
 
 if (catchUp ) {
 CGFloat timeStamp = av_frame_get_best_effort_timestamp(_videoFrame) * _videoTimeBase;
 catchUp = totalDuration > (timeStamp - timeStampAtEntry);
 if (!catchUp) {
 CGFloat nextTotalDuration = [[NSDate date] timeIntervalSinceDate:timeAtEntry];
 if (nextTotalDuration < totalDuration && nextTotalDuration > 0.5) {
 totalDuration = nextTotalDuration;
 timeAtEntry = [NSDate date];
 timeStampAtEntry = timeStamp; 
 catchUp = true;
 }
 }
 if ([configuration.recordStream intValue] == 1) {
 [self writeToFile: packet];
 }
 
 } else {
 
 if (!_disableDeinterlacing &&
 _videoFrame->interlaced_frame) {
 
 avpicture_deinterlace((AVPicture*)_videoFrame,
 (AVPicture*)_videoFrame,
 _videoCodecCtx->pix_fmt,
 _videoCodecCtx->width,
 _videoCodecCtx->height);
 }
 
 KxVideoFrame *frame = [self handleVideoFrame];
 if (frame) {
 
 [result addObject:frame];
 _position = frame.position;
 decodedDuration += frame.duration;
 if (decodedDuration > minDuration)
 finished = YES;
 }
 

 if ([configuration.recordStream intValue] == 1) {
 [self writeToFile: packet];
 }
 
 
 
 }
 }
 
 if (0 == len)
 break;
 
 pktSize -= len;
 }
 }
 
 
 
 
 av_free_packet(&packet);
 }
 } while (catchUp);
 _reading = [NSNumber numberWithInt:0];
 [TimeHelper resetTimeEnteredForeground];
 [TimeHelper resetTimeEnteredBackground];
 
 return result;
 }
 
 }

 return result;

 }



-
RTSP to HLS conversion with error on some devices
2 septembre 2024, par Wallace KetlerI'm trying to convert, on a node server, RTSP IP camera devices to HLS to run livestreams on the web. The following code works well for some RTSP devices, but for others I encounter problems.


function startLive(rtspUrl, outputDir, id_local, id_camera) {
 return new Promise((resolve, reject) => {
 const processKey = `${id_local}_${id_camera}`;
 if (ffmpegProcesses[processKey]) {
 return reject(new Error('Conversão já está em andamento para esta câmera'));
 }
 
 const process = ffmpeg(rtspUrl)
 .inputOptions([
 '-rtsp_transport', 'tcp',
 '-fflags', 'nobuffer',
 '-max_delay', '1000000',
 '-analyzeduration', '1000000',
 '-probesize', '1000000',
 '-flush_packets', '1',
 '-avioflags', 'direct'
 ])
 .outputOptions([
 '-c:v', 'libx264',
 '-preset', 'ultrafast',
 '-tune', 'zerolatency',
 '-c:a', 'aac',
 '-hls_time', '10',
 '-hls_flags', 'delete_segments',
 '-hls_list_size', '5',
 '-hls_wrap', '5',
 '-strict', '-2'
 ])
 .output(path.join(outputDir, 'stream.m3u8'))
 .on('start', (commandLine) => {
 console.log('Spawned FFmpeg with command: ' + commandLine);
 })
 .on('stderr', (stderrLine) => {
 console.log('FFmpeg stderr: ' + stderrLine);
 })
 .on('end', () => {
 console.log('Conversão concluída');
 delete ffmpegProcesses[processKey]; 
 resolve();
 })
 .on('error', (err, stdout, stderr) => {
 console.error('Erro na conversão', err);
 console.error('FFmpeg stdout:', stdout);
 console.error('FFmpeg stderr:', stderr);
 delete ffmpegProcesses[processKey]; 
 reject(err);
 })
 .run();
 
 ffmpegProcesses[processKey] = process; 
 });
 }



When the conversion succeeds, it continues indefinitely with the logs :


FFmpeg stderr: frame= 61 fps= 48 q=13.0 size=N/A time=00:00:02.03 bitrate=N/A dup=60 drop=0 speed= 1.6x 
FFmpeg stderr: frame= 75 fps= 42 q=17.0 size=N/A time=00:00:02.52 bitrate=N/A dup=62 drop=0 speed=1.41x 
FFmpeg stderr: frame= 91 fps= 39 q=16.0 size=N/A time=00:00:03.04 bitrate=N/A dup=65 drop=0 speed=1.31x 
FFmpeg stderr: frame= 108 fps= 38 q=15.0 size=N/A time=00:00:03.60 bitrate=N/A dup=68 drop=0 speed=1.27x 
FFmpeg stderr: frame= 121 fps= 36 q=24.0 size=N/A time=00:00:04.03 bitrate=N/A dup=70 drop=0 speed=1.21x 
FFmpeg stderr: frame= 138 fps= 36 q=16.0 size=N/A time=00:00:04.60 bitrate=N/A dup=73 drop=0 speed= 1.2x 
FFmpeg stderr: frame= 152 fps= 35 q=17.0 size=N/A time=00:00:05.08 bitrate=N/A dup=75 drop=0 speed=1.17x 
FFmpeg stderr: frame= 168 fps= 35 q=16.0 size=N/A time=00:00:05.60 bitrate=N/A dup=78 drop=0 speed=1.15x 
FFmpeg stderr: frame= 183 fps= 34 q=21.0 size=N/A time=00:00:06.11 bitrate=N/A dup=80 drop=0 speed=1.13x 
FFmpeg stderr: frame= 198 fps= 34 q=16.0 size=N/A time=00:00:06.60 bitrate=N/A dup=83 drop=0 speed=1.12x 
FFmpeg stderr: frame= 215 fps= 33 q=16.0 size=N/A time=00:00:07.16 bitrate=N/A dup=86 drop=0 speed=1.11x 
FFmpeg stderr: frame= 230 fps= 33 q=16.0 size=N/A time=00:00:07.66 bitrate=N/A dup=88 drop=0 speed= 1.1x 
FFmpeg stderr: frame= 246 fps= 33 q=19.0 size=N/A time=00:00:08.20 bitrate=N/A dup=91 drop=0 speed= 1.1x 



And with the segments saved in the folder configured as output. But for certain devices, after creating the stream.m3u8 file and saving the first segment, the conversion is considered finished and falls into
.on('end')
. The error log is as follows :

FFmpeg stderr: frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:01.12 bitrate=N/A speed=2.08x 
FFmpeg stderr: [hls @ 0x55e00dfc4380] Opening 'my_path/stream0.ts' for writing
FFmpeg stderr: [hls @ 0x55e00dfc4380] Opening 'my_path/stream.m3u8.tmp' for writing
FFmpeg stderr: frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:01.37 bitrate=N/A speed= 2.5x 
FFmpeg stderr: video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
FFmpeg stderr: [aac @ 0x55e00dfff840] Qavg: 65536.000
FFmpeg stderr: 
Conversão concluída



The
muxing overhead: unknown
only appears when the error occurs and the conversion is complete.

I've already tried changing the video and audio encoders, as well as the various input and output parameters of the conversion. I also tried updating ffmpeg (it's already on the latest version, using fluent-ffmpeg,
"fluent-ffmpeg": "^2.1.3",
)

I would like to understand why this happens on some devices and how to fix it. Thanks.


-
avfilter/firequalizer : add dumpfile and dumpscale option
17 octobre 2016, par Muhammad Faiz