
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (98)
-
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 ;
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (5621)
-
Use Named Pipe (C++) to send images to FFMPEG
10 décembre 2017, par user1829136I have the following code in C++ :
#include <iostream>
#include
#include <iostream> // std::cout
#include <fstream> // std::ifstream
#include <vector>
#include
using namespace std;
int main(int argc, const char **argv)
{
wcout << "Creating an instance of a named pipe..." << endl;
// Create a pipe to send data
HANDLE pipe = CreateNamedPipe(
L"\\\\.\\pipe\\my_pipe", // name of the pipe
PIPE_ACCESS_OUTBOUND, // 1-way pipe -- send only
PIPE_TYPE_BYTE, // send data as a byte stream
1, // only allow 1 instance of this pipe
0, // no outbound buffer
0, // no inbound buffer
0, // use default wait time
NULL // use default security attributes
);
if (pipe == NULL || pipe == INVALID_HANDLE_VALUE) {
wcout << "Failed to create outbound pipe instance.";
// look up error code here using GetLastError()
system("pause");
return 1;
}
wcout << "Waiting for a client to connect to the pipe..." << endl;
// This call blocks until a client process connects to the pipe
BOOL result = ConnectNamedPipe(pipe, NULL);
if (!result) {
wcout << "Failed to make connection on named pipe." << endl;
// look up error code here using GetLastError()
CloseHandle(pipe); // close the pipe
system("pause");
return 1;
}
wcout << "Sending data to pipe..." << endl;
//opening file
ifstream infile;
infile.open("E:/xmen.jpg",std::ios::binary);
ofstream out("E:/lelel.jpg",std::ios::binary);
infile.seekg(0,std::ios::end);
size_t file_size_in_byte = infile.tellg();
vector<char> file_vec;
file_vec.resize(file_size_in_byte);
infile.seekg(0,std::ios::beg);
infile.read(&file_vec[0],file_size_in_byte);
out.write(&file_vec[0],file_vec.size());
wcout</ This call blocks until a client process reads all the data
DWORD numBytesWritten = 0;
result = WriteFile(
pipe, // handle to our outbound pipe
&file_vec[0], // data to send
61026, // length of data to send (bytes)
&numBytesWritten, // will store actual amount of data sent
NULL // not using overlapped IO
);
if (result) {
wcout << "Number of bytes sent: " << numBytesWritten << endl;
} else {
wcout << "Failed to send data." << endl;
// look up error code here using GetLastError()
}
// Close the pipe (automatically disconnects client too)
CloseHandle(pipe);
wcout << "Done." << endl;
system("pause");
return 0;
}
</char></vector></fstream></iostream></iostream>Which I use to create a named pipe \.\pipe\my_pipe, to which FFMPEG connects to, using the following command :
64-static\bin\Video>ffmpeg.exe -loop 1 -s 4cif -f image2 -y -i \\.\pipe\\my_pipe
-r 25 -vframes 250 -vcodec rawvideo -an eaeew.mov
Output :
ffmpeg version N-54233-g86190af Copyright (c) 2000-2013 the FFmpeg developers
built on Jun 27 2013 16:49:12 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 17.100 / 55. 17.100
libavformat 55. 10.100 / 55. 10.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
[image2 @ 0000000003ee04a0] Could find no file with with path '\\.\pipe\\my_pipe
' and index in the range 0-4
\\.\pipe\\my_pipe: No such file or directoryI can see on my console that my C++ app received a connection, but I get the error above in FFMPEG. Can someone please advise ?
EDIT 1
Using the command belowffmpeg.exe -s 4cif -i \\.\pipe\my_pipe -r 25 -vframes 250 -vcodec rawvideo -an tess.mov
I get the following output
ffmpeg version N-54233-g86190af Copyright (c) 2000-2013 the FFmpeg developers
built on Jun 27 2013 16:49:12 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 17.100 / 55. 17.100
libavformat 55. 10.100 / 55. 10.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
\\.\pipe\my_pipe: Invalid data found when processing inputSo, now it seems it was able to connect to the pipe but is not able to process the input.
-
spawn ffmpeg in nodejs and pipe to express's response
18 décembre 2017, par ViGii am spawning ffmpeg and pipe it’s output (the video stream i want) to express’s response object like this :
app.get('/stream', (req, res) => {
let _url = req.query.url;
if(_url){
res.writeHead(200, {
'Access-Control-Allow-Origin': '*',
'Connection': 'Keep-Alive',
'Content-Type': 'video/mp4'
});
// transcode rtsp input from ip-cam to mp4 file format (video: h.264 | audio: aac)
let ffmpeg = child_process.spawn("ffmpeg",[
"-probesize","2147483647",
"-analyzeduration","2147483647",
"-i", _url,
"-vcodec","copy",
"-f", "mp4",
"-movflags","frag_keyframe+empty_moov+faststart",
"-frag_duration","3600",
"pipe:1"
]);
// redirect transcoded ip-cam stream to http response
ffmpeg.stdout.pipe(res);
// error logging
ffmpeg.stderr.setEncoding('utf8');
ffmpeg.stderr.on('data', (data) => {
console.log(data);
});
}
else{
res.end();
}so far it’s working like a charm.
however somewhere in there seems to be a cap. i can get only 3 streams running at the same time. when a 4th spawn occurs the 4th thread will block one of the cpu cores :and naturally the 4th stream does not reach the browser..
has somebody any idea of what am i missing ?EDIT : it’s not tied to the fact that i am running the nodejs project on the raspberry pi. it also behaves the same way on my windows 10 machine
-
youtube-dl streaming to pipe, how to add container
24 décembre 2017, par MetNPI use this command on raspberry-pi :
youtube-dl -o- [youtubeurl] | omxplayer --no-keys pipe:0
and it works great for 50% of youtube content. For non-working videos, omxplayer just won’t play it. It is not raspberry nor omxplayer specific problem. All players are ffmpeg based and for those videos the same problem can be achieved on any platform with ffplay or ffmpeg live transcode...
When i download that kind of video separatelly :
youtube-dl -o name.mp4 [url]
ffplay name.mp4 ... works OK
cat name.mp4 | ffplay - ... does NOT work (input stream not recognized well)Reason for this problem is well explained here. MP4 by itself is not good enough for streaming, and i want just to envelope it inside some TS or MKV or any container that will help player.
Does someone have an idea how to do it ? Can youtube-dl be forced to do it itself, and can some middle ffmpeg command helps ?
update : thanks to directions from Mulvya comment, it seems that all video works well with
-f mp4
addition :youtube-dl -o- -f mp4 [youtubeurl] | omxplayer --no-keys pipe:0
selecting specific format like -f 135+140 breaks pipe usability, and will not work except with some possible code changes. Until i reach some other problematic video content, it seems that -f mp4 solved everything.