
Recherche avancée
Médias (1)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
Autres articles (111)
-
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 (...) -
Les notifications de la ferme
1er décembre 2010, parAfin d’assurer une gestion correcte de la ferme, il est nécessaire de notifier plusieurs choses lors d’actions spécifiques à la fois à l’utilisateur mais également à l’ensemble des administrateurs de la ferme.
Les notifications de changement de statut
Lors d’un changement de statut d’une instance, l’ensemble des administrateurs de la ferme doivent être notifiés de cette modification ainsi que l’utilisateur administrateur de l’instance.
À la demande d’un canal
Passage au statut "publie"
Passage au (...) -
Initialisation de MediaSPIP (préconfiguration)
20 février 2010, parLors de l’installation de MediaSPIP, celui-ci est préconfiguré pour les usages les plus fréquents.
Cette préconfiguration est réalisée par un plugin activé par défaut et non désactivable appelé MediaSPIP Init.
Ce plugin sert à préconfigurer de manière correcte chaque instance de MediaSPIP. Il doit donc être placé dans le dossier plugins-dist/ du site ou de la ferme pour être installé par défaut avant de pouvoir utiliser le site.
Dans un premier temps il active ou désactive des options de SPIP qui ne le (...)
Sur d’autres sites (8958)
-
FFmpeg - feed raw frames via pipe - FFmpeg does not detect pipe closure
8 septembre 2018, par RumbleIm trying to follow these examples from C++ in Windows. Phyton Example C# Example
I have an application that produces raw frames that shall be encoded with FFmpeg.
The raw frames are transfered via IPC pipe to FFmpegs STDIN. That is working as expected, FFmpeg even displays the number of frames currently available.The problem occours when we are done sending frames. When I close the write end of the pipe I would expect FFmpeg to detect that, finish up and output the video. But that does not happen. FFmpeg stays open and seems to wait for more data.
I made a small test project in VisualStudio.
#include "stdafx.h"
//// stdafx.h
//#include "targetver.h"
//#include
//#include
//#include <iostream>
#include "Windows.h"
#include <cstdlib>
using namespace std;
bool WritePipe(void* WritePipe, const UINT8 *const Buffer, const UINT32 Length)
{
if (WritePipe == nullptr || Buffer == nullptr || Length == 0)
{
cout << __FUNCTION__ << ": Some input is useless";
return false;
}
// Write to pipe
UINT32 BytesWritten = 0;
UINT8 newline = '\n';
bool bIsWritten = WriteFile(WritePipe, Buffer, Length, (::DWORD*)&BytesWritten, nullptr);
cout << __FUNCTION__ << " Bytes written to pipe " << BytesWritten << endl;
//bIsWritten = WriteFile(WritePipe, &newline, 1, (::DWORD*)&BytesWritten, nullptr); // Do we need this? Actually this should destroy the image.
FlushFileBuffers(WritePipe); // Do we need this?
return bIsWritten;
}
#define PIXEL 80 // must be multiple of 8. Otherwise we get warning: Bytes are not aligned
int main()
{
HANDLE PipeWriteEnd = nullptr;
HANDLE PipeReadEnd = nullptr;
{
// create us a pipe for inter process communication
SECURITY_ATTRIBUTES Attr = { sizeof(SECURITY_ATTRIBUTES), NULL, true };
if (!CreatePipe(&PipeReadEnd, &PipeWriteEnd, &Attr, 0))
{
cout << "Could not create pipes" << ::GetLastError() << endl;
system("Pause");
return 0;
}
}
// Setup the variables needed for CreateProcess
// initialize process attributes
SECURITY_ATTRIBUTES Attr;
Attr.nLength = sizeof(SECURITY_ATTRIBUTES);
Attr.lpSecurityDescriptor = NULL;
Attr.bInheritHandle = true;
// initialize process creation flags
UINT32 CreateFlags = NORMAL_PRIORITY_CLASS;
CreateFlags |= CREATE_NEW_CONSOLE;
// initialize window flags
UINT32 dwFlags = 0;
UINT16 ShowWindowFlags = SW_HIDE;
if (PipeWriteEnd != nullptr || PipeReadEnd != nullptr)
{
dwFlags |= STARTF_USESTDHANDLES;
}
// initialize startup info
STARTUPINFOA StartupInfo = {
sizeof(STARTUPINFO),
NULL, NULL, NULL,
(::DWORD)CW_USEDEFAULT,
(::DWORD)CW_USEDEFAULT,
(::DWORD)CW_USEDEFAULT,
(::DWORD)CW_USEDEFAULT,
(::DWORD)0, (::DWORD)0, (::DWORD)0,
(::DWORD)dwFlags,
ShowWindowFlags,
0, NULL,
HANDLE(PipeReadEnd),
HANDLE(nullptr),
HANDLE(nullptr)
};
LPSTR ffmpegURL = "\"PATHTOFFMPEGEXE\" -y -loglevel verbose -f rawvideo -vcodec rawvideo -framerate 1 -video_size 80x80 -pixel_format rgb24 -i - -vcodec mjpeg -framerate 1/4 -an \"OUTPUTDIRECTORY\"";
// Finally create the process
PROCESS_INFORMATION ProcInfo;
if (!CreateProcessA(NULL, ffmpegURL, &Attr, &Attr, true, (::DWORD)CreateFlags, NULL, NULL, &StartupInfo, &ProcInfo))
{
cout << "CreateProcess failed " << ::GetLastError() << endl;
}
//CloseHandle(ProcInfo.hThread);
// Create images and write to pipe
#define MYARRAYSIZE (PIXEL*PIXEL*3) // each pixel has 3 bytes
UINT8* Bitmap = new UINT8[MYARRAYSIZE];
for (INT32 outerLoopIndex = 9; outerLoopIndex >= 0; --outerLoopIndex) // frame loop
{
for (INT32 innerLoopIndex = MYARRAYSIZE - 1; innerLoopIndex >= 0; --innerLoopIndex) // create the pixels for each frame
{
Bitmap[innerLoopIndex] = (UINT8)(outerLoopIndex * 20); // some gray color
}
system("pause");
if (!WritePipe(PipeWriteEnd, Bitmap, MYARRAYSIZE))
{
cout << "Failed writing to pipe" << endl;
}
}
// Done sending images. Tell the other process. IS THIS NEEDED? HOW TO TELL FFmpeg WE ARE DONE?
//UINT8 endOfFile = 0xFF; // EOF = -1 == 1111 1111 for uint8
//if (!WritePipe(PipeWriteEnd, &endOfFile, 1))
//{
// cout << "Failed writing to pipe" << endl;
//}
//FlushFileBuffers(PipeReadEnd); // Do we need this?
delete Bitmap;
system("pause");
// clean stuff up
FlushFileBuffers(PipeWriteEnd); // Do we need this?
if (PipeWriteEnd != NULL && PipeWriteEnd != INVALID_HANDLE_VALUE)
{
CloseHandle(PipeWriteEnd);
}
// We do not want to destroy the read end of the pipe? Should not as that belongs to FFmpeg
//if (PipeReadEnd != NULL && PipeReadEnd != INVALID_HANDLE_VALUE)
//{
// ::CloseHandle(PipeReadEnd);
//}
return 0;
}
</cstdlib></iostream>And here the output of FFmpeg
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[rawvideo @ 00000221ff992120] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
Input #0, rawvideo, from 'pipe:':
Duration: N/A, start: 0.000000, bitrate: 153 kb/s
Stream #0:0: Video: rawvideo, 1 reference frame (RGB[24] / 0x18424752), rgb24, 80x80, 153 kb/s, 1 fps, 1 tbr, 1 tbn, 1 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
[graph 0 input from stream 0:0 @ 00000221ff999c20] w:80 h:80 pixfmt:rgb24 tb:1/1 fr:1/1 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 00000221ffa071a0] w:iw h:ih flags:'bicubic' interl:0
[format @ 00000221ffa04e20] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_null_0' and the filter 'format'
[swscaler @ 00000221ffa0a780] deprecated pixel format used, make sure you did set range correctly
[auto_scaler_0 @ 00000221ffa071a0] w:80 h:80 fmt:rgb24 sar:0/1 -> w:80 h:80 fmt:yuvj444p sar:0/1 flags:0x4
Output #0, mp4, to 'c:/users/vr3/Documents/Guenni/sometest.mp4':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: mjpeg, 1 reference frame (mp4v / 0x7634706D), yuvj444p(pc), 80x80, q=2-31, 200 kb/s, 1 fps, 16384 tbn, 1 tbc
Metadata:
encoder : Lavc57.107.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 10 fps=6.3 q=1.6 size= 0kB time=00:00:09.00 bitrate= 0.0kbits/s speed=5.63xAs you can see in the last line of te FFmpeg output, the images got trough. 10 frames are available. But after closing the pipe, FFmpeg does not close, still expecting input.
As the linked examples show, this should be a valid method.
Trying for a week now...
-
Create stopmotion video with ffmpeg - error while rendering
30 mai 2012, par NiklasI'm currently creating a stopmotion video with the help of ffmpeg and some scripts I've made. Although in the last clip I attempted to render I had a couple of frames which I've edited. The method I'm using has worked before so I'm certain that it has to do with GIMP changing something with the files. I work with .png-images. This is the command and the output I get :
ffmpeg -sameq -f image2 -r 7 -i "$src_dir/frame-%06d.png" -r 25 "$dest_dir/$file_name.avi"
output :
ffmpeg version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the Libav developers
built on Mar 22 2012 05:09:06 with gcc 4.6.3
This program is not developed anymore and is only provided for compatibility. Use avconv instead (see Changelog for the list of incompatible changes).
Input #0, image2, from '/mnt/storage/selected_frames/005-Middag-Animation/frame-%06d.png':
Duration: 00:00:02.85, start: 0.000000, bitrate: N/A
Stream #0.0: Video: png, bgra, 1280x720, 7 fps, 7 tbr, 7 tbn, 7 tbc
File '/mnt/storage/Videoklipp//005-Middag-Animation.avi' already exists. Overwrite ? [y/N] y
Incompatible pixel format 'bgra' for codec 'mpeg4', auto-selecting format 'yuv420p'
[buffer @ 0x1b88860] w:1280 h:720 pixfmt:bgra
[avsink @ 0x1b8a480] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x1b8ab80] w:1280 h:720 fmt:bgra -> w:1280 h:720 fmt:yuv420p flags:0x4
Output #0, avi, to '/mnt/storage/Videoklipp//005-Middag-Animation.avi':
Metadata:
ISFT : Lavf53.21.0
Stream #0.0: Video: mpeg4, yuv420p, 1280x720, q=2-31, 2 kb/s, 25 tbn, 25 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
[buffer @ 0x1b88860] Changing frame properties on the fly is not supported.
Last message repeated 6 times
frame= 13 fps= 0 q=0.0 Lsize= 524kB time=2.20 bitrate=1951.2kbits/s
video:517kB audio:0kB global headers:0kB muxing overhead 1.323318%"[buffer @ 0x1b88860] Changing frame properties on the fly is not supported"
What can I do to fix this ? Any help is appreciated :)
-
Why does ffmpeg report different durations ?
18 mai 2012, par kenitechSource videos : http://www.artworknotavailable.com/tmp/ffmpegtest
Quicktime Pro 7.7.1 Inspector (Win 7) reports the following for the file 2398.mov
4.19MB
H.264
Movie FPS : 23.98
Data Rate : 2.35 mbits/Sec
Duration 14:97ffmpeg reports the following (see full ffmpeg version info at bottom of post)
ffmpeg -i 2398.mov
Seems stream 1 codec frame rate differs from container frame rate : 47952.00 (47952/1) -> >23.98 (2997/125)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2398.mov' :
Metadata :
major_brand : qtminor_version : 537199360
compatible_brands : qt
Duration : 00:00:15.97, start : 0.-963005, bitrate : 2210 kb/s
Stream #0.0(eng) : Audio : aac, 48000 Hz, stereo, s16, 152 kb/s
Stream #0.1(eng) : Video : h264, yuv420p, 848x480, 2060 kb/s, 23.98 fps, 23.98 tbr, 23976 tbn, 47952 tbcOne second longer than what Quicktime reports.
As an experiment I exported this file from Quicktime Pro using the following settings :
Frame Rate : Current
Key Frames : Every 24 frames
Frame Reordering On
Quality : High
Encoding Best
Data Rate : Automatic
Optimized for Download
Output file : qtime-export-2398.movQuicktime Inspector reports :
5.62 MB
H.264
Movie FPS : 23.98
Data Rate : 3.15 mbits/Sec
Duration 14:97ffmpeg now reports :
ffmpeg -i qtime-export-2398.mov
Seems stream 1 codec frame rate differs from container frame rate : 1200.00 (1200/1) -> 23.98 (24000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'qtime-export-2398.mov' :
Metadata :
major_brand : qt
minor_version : 537199360
compatible_brands : qt
Duration : 00:00:14.96, start : 0.000000, bitrate : 3153 kb/s
Stream #0.0(eng) : Audio : pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
Stream #0.1(eng) : Video : h264, yuv420p, 678x384, 1738 kb/s, 23.98 fps, 23.98 tbr, 600 tbn, 1200 tbcffmpeg's report on duration went from 15.97 to 14.96 (I can live with .1)
Is this duration calculated from the bitrate ?
I need to accurately report the duration of uploaded videos as well as convert them to FLV. Can somebody tell me what is going on here and how I might get around this ?
ffmpeg info below. I've tried this on 2 completely different installs/versions of ffmpeg. Same result.
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 23:55:02 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration : —prefix=/usr —libdir=/usr/lib64 —shlibdir=/usr/lib64 —mandir=/usr/share/man —incdir=/usr/include —disable-avisynth —extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector —param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' —enable-avfilter —enable-avfilter-lavf —enable-libdirac —enable-libfaac —enable-libfaad —enable-libfaadbin —enable-libgsm —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libx264 —enable-gpl —enable-nonfree —enable-postproc —enable-pthreads —enable-shared —enable-swscale —enable-vdpau —enable-version3 —enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
FFmpeg 0.6.5
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0