
Recherche avancée
Autres articles (99)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela. -
L’agrémenter visuellement
10 avril 2011MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté.
Sur d’autres sites (12957)
-
Exit FFMPEG when a line freezes
21 juin 2021, par user15966041I have a ffmpeg bat file for retrieving streams through rtsp


bat file


ffmpeg -xerror -loglevel error -stimeout 1111111 -rtsp_transport tcp -v verbose -i "rtsp://admin:admin1234@10.8.0.14:81/cam/realmonitor?channel=1&subtype=1 " -vf scale=1024:576 -vcodec libx264 -sc_threshold 0 -f hls -hls_flags delete_segments -hls_time 2 -segment_time 2 -hls_list_size 2 C:\Apache24\htdocs\smartmine\ipcam\video_1\stream.m3u8 





The problem im facing is that, after ffmpeg had run for a few hours, the speed decreases and the processing of the video stops and stays on that single line.


Is there any way to exit the ffmpeg when this is happening. I have tried a lot of methods, but none of them worked out. Thanks a lot


-
FFmpeg does not exit even though processing has finished
23 mars 2021, par LTRI'm starting ffmpeg.exe from C# on Windows. Then I send some frames for encoding via the stdin stream. When all frames have been sent, I close the stdin stream. This tells FFmpeg to exit. I have used this method in other projects before, and it has always worked before.


In this case, it doesn't work. FFmpeg realizes the standard input stream has been closed, and finishes the output file. But then, the ffmpeg.exe process just remains open without exiting.


What's wrong here ?


[TestMethod]
 public void FfmpegNotReacting()
 {
 Size frameSize = new Size(854, 480);
 

 var ffmpegProcess = new Process();
 ffmpegProcess.StartInfo
 = new ProcessStartInfo("ffmpeg_64.exe")
 {
 Arguments = $"-loglevel verbose -report -f rawvideo -vcodec rawvideo -pixel_format rgb32 -video_size {frameSize.Width}x{frameSize.Height} -r 30 -i pipe:0 -c:v libx264 -vf format=yuv420p -preset medium -y -crf 18 output.mp4",
 RedirectStandardError = true,
 RedirectStandardInput = true,
 RedirectStandardOutput = true,
 CreateNoWindow = true,
 UseShellExecute = false
 };
 ffmpegProcess.Start();

 // Just add one empty frame
 int bytesPerFrame = frameSize.Width * frameSize.Height * 4;
 ffmpegProcess.StandardInput.BaseStream.Write(new byte[bytesPerFrame], 0, bytesPerFrame);

 ffmpegProcess.StandardInput.BaseStream.Close();

 ffmpegProcess.WaitForExit();

 }



According to How to stop ffmpeg process after it has finished processing in C# ? ShellExecute=true might fix the problem. However, I can't do that here because I need ShellExecute in order to redirect StdInput.


Here's the last couple of lines from the ffmpeg output (with some irrelevant messages removed) :


[output stream 0:0 @ 000002632cf844c0] EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
[libx264 @ 000002632cf79c20] frame= 0 QP=9.00 NAL=3 Slice:I Poc:0 I:1620 P:0 SKIP:0 size=125 bytes
frame= 1 fps=0.0 q=24.0 Lsize= 2kB time=00:00:00.03 bitrate= 387.4kbits/s speed=3.33x 
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 98.280098%
Input file #0 (pipe:0):
 Input stream #0:0 (video): 1 packets read (1639680 bytes); 1 frames decoded; 
 Total: 1 packets (1639680 bytes) demuxed
Output file #0 (output.mp4):
 Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (814 bytes); 
 Total: 1 packets (814 bytes) muxed
1 frames successfully decoded, 0 decoding errors



-
ffmpeg won't exit normally with SIGINT
2 mars 2021, par ntstlkrI'm trying to record video with ffmpeg and all works fine when I call stopRecord() function inside timeout :


frame= 147 fps= 18 q=-1.0 Lsize= 290kB time=00:00:09.91 bitrate= 239.8kbits/s speed=1.24x 
video:129kB audio:156kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 
2.159774%
[aac @ 0x55e825dbdc40] 
Qavg: 241.892
Exiting normally, received signal 2.
SIGINT
Recording process exit, code: 255, signal: null
Recording stopped



But ffmpeg process won't exit and stays alive when I call stopRecord() function on API request inside express router.


// here I create child process and try to close it in timeout which works.
export async function startRecord(producers: any, router: any, folderName: string, fileName: string) {
const sdp = `v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio ${ports[0]} RTP/AVPF 111
a=rtcp:${ports[0] + 1}
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
m=video ${ports[1]} RTP/AVPF 125
a=rtcp:${ports[1] + 1}
a=rtpmap:125 H264/90000
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f`;

const cmdArgStr = [
 "-protocol_whitelist pipe,rtp,udp",
 "-fflags +genpts",
 "-f sdp",
 "-i pipe:0",
 "-map 0:a:0 -c:a aac",
 "-map 0:v:0 -c:v copy",
 "-f mp4 -strict experimental",
 `-y recording/${folderName}/${fileName}.mp4`,
].join(" ").trim();

let process = spawn('ffmpeg', cmdArgStr.split(/\s+/));

process.stdin.write(sdp);
process.stdin.end();

process.on("error", (err: string) => {
 console.log('error');
 console.error("Recording process error:", err);
});

process.on("exit", (code: string, signal: string) => {
 process.kill('SIGINT');
 console.log('SIGINT');
 console.log("Recording process exit, code: %d, signal: %s", code, signal);

 if (!signal || signal === "SIGINT") {


 console.log("Recording stopped");
 } else {
 console.warn(
 "Recording process didn't exit cleanly, output file might be corrupt"
 );
 }
 });

 process.stderr.on("data", (chunk: string) => {
 chunk
 .toString()
 .split(/\r?\n/g)
 .filter(Boolean)
 .forEach(async (line: any) => {
 console.log(line);
 if (line.startsWith("ffmpeg version")) {
 for (const consumer of consumers) {
 await consumer.resume();
 }
 }
 });
 });

 // this works!!
 setTimeout(() => {
 stopRecord(process);
 }, 10000);


 return process;
}

// this not works!! I call this function externally inside express router on API request
export function stopRecord(process: any) {
 process.kill('SIGINT');
}



Linux process stays alive when I call stopRecord() inside express router, but property "killed" of process marked as true. It's only works when I send "SIGKILL" inside express router. I need to exit normally, because ffmpeg needs to save mp4 metadata.


So the general question is : Why stopRecord function works inside timeout even with "SIGINT" code, but it doesn't when I call this function externally inside express router. Only "SIGKILL" works when I call stopRecord() inside express router.


Renaming my "process" field doesn't help.


I really don't understand why the same function works different inside timeout and inside express router. And I very thankful for any advice !


I'm using node, typescript and express.