
Recherche avancée
Autres articles (51)
-
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 -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Contribute to documentation
13 avril 2011Documentation is vital to the development of improved technical capabilities.
MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
To contribute, register to the project users’ mailing (...)
Sur d’autres sites (6572)
-
Video encoded by ffmpeg.exe giving me a garbage video in c# .net
10 septembre 2018, par Amit YadavI want to record video through webcam and file to be saved in
.mp4
format. So for recording i am usingAforgeNet.dll
for recording and formp4
format i am encoding raw video intomp4
usingffmpeg.exe
usingNamedPipeStreamServer
as i receive frame i push into the named pipe buffer. this process works fine i have checked inProcessTheErrorData
event but when i stop recording the output file play garbage video shown in the image belowHere is Code for this
Process Process;
NamedPipeServerStream _ffmpegIn;
byte[] _videoBuffer ;
const string PipePrefix = @"\\.\pipe\";
public void ffmpegWriter()
{
if(File.Exists("outputencoded.mp4"))
{
File.Delete("outputencoded.mp4");
}
_videoBuffer = new byte[widht * heigth * 4];
var audioPipeName = GetPipeName();
var videoPipeName = GetPipeName();
var videoInArgs = $@" -thread_queue_size 512 -use_wallclock_as_timestamps 1 -f rawvideo -pix_fmt rgb32 -video_size 640x480 -i \\.\pipe\{videoPipeName}";
var videoOutArgs = $"-vcodec libx264 -crf 15 -pix_fmt yuv420p -preset ultrafast -r 10";
_ffmpegIn = new NamedPipeServerStream(videoPipeName, PipeDirection.Out, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous, 0, _videoBuffer.Length);
Process=StartFFmpeg($"{videoInArgs} {videoOutArgs} \"{"outputencoded.mp4"}\"", "outputencoded.mp4");
}
bool WaitForConnection(NamedPipeServerStream ServerStream, int Timeout)
{
var asyncResult = ServerStream.BeginWaitForConnection(Ar => { }, null);
if (asyncResult.AsyncWaitHandle.WaitOne(Timeout))
{
ServerStream.EndWaitForConnection(asyncResult);
return ServerStream.IsConnected;
}
return false;
}
static string GetPipeName() => $"record-{Guid.NewGuid()}";
public static Process StartFFmpeg(string Arguments, string OutputFileName)
{
var process = new Process
{
StartInfo =
{
FileName = "ffmpeg.exe",
Arguments = Arguments,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardInput = true,
},
EnableRaisingEvents = true
};
// var logItem = ServiceProvider.Get<ffmpeglog>().CreateNew(Path.GetFileName(OutputFileName));
process.ErrorDataReceived += (s, e) => ProcessTheErrorData(s,e);
process.Start();
process.BeginErrorReadLine();
return process;
}
</ffmpeglog>and Writing each frame like this.
private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
try
{
if (_recording)
{
using (var bitmap = (Bitmap) eventArgs.Frame.Clone())
{
var _videoBuffers = ImageToByte(bitmap);
if (_firstFrameTime != null)
{
bitmap.Save("image/" + DateTime.Now.ToString("ddMMyyyyHHmmssfftt")+".bmp");
_lastFrameTask?.Wait();
_lastFrameTask = _ffmpegIn.WriteAsync(_videoBuffers, 0, _videoBuffers.Length);
}
else
{
if (_firstFrame)
{
if (!WaitForConnection(_ffmpegIn, 5000))
{
throw new Exception("Cannot connect Video pipe to FFmpeg");
}
_firstFrame = false;
}
_firstFrameTime = DateTime.Now;
_lastFrameTask?.Wait();
_lastFrameTask = _ffmpegIn.WriteAsync(_videoBuffers, 0, _videoBuffers.Length);
}
}
}
using (var bitmap = (Bitmap) eventArgs.Frame.Clone())
{
var bi = bitmap.ToBitmapImage();
bi.Freeze();
Dispatcher.CurrentDispatcher.Invoke(() => Image = bi);
}
}
catch (Exception exc)
{
MessageBox.Show("Error on _videoSource_NewFrame:\n" + exc.Message, "Error", MessageBoxButton.OK,
MessageBoxImage.Error);
StopCamera();
}
}Even i have written each frame to disk as bitmap .bmp and frames are correct but i don’t know what’s i am missing here ? please help thanks in advance.
-
How do I set ffmpeg pipe output ?
5 décembre 2019, par mr_blondI need to read ffmpeg output as pipe.
There is a code example :public static void PipeTest()
{
Process proc = new Process();
proc.StartInfo.FileName = Path.Combine(WorkingFolder, "ffmpeg");
proc.StartInfo.Arguments = String.Format("$ ffmpeg -i input.mp3 pipe:1");
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardInput = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
FileStream baseStream = proc.StandardOutput.BaseStream as FileStream;
byte[] audioData;
int lastRead = 0;
using (MemoryStream ms = new MemoryStream())
{
byte[] buffer = new byte[5000];
do
{
lastRead = baseStream.Read(buffer, 0, buffer.Length);
ms.Write(buffer, 0, lastRead);
} while (lastRead > 0);
audioData = ms.ToArray();
}
using(FileStream s = new FileStream(Path.Combine(WorkingFolder, "pipe_output_01.mp3"), FileMode.Create))
{
s.Write(audioData, 0, audioData.Length);
}
}It’s log from ffmpeg, the first file is readed :
Input #0, mp3, from ’norm.mp3’ :
Metadata :
encoder : Lavf58.17.103
Duration : 00:01:36.22, start : 0.023021, bitrate : 128 kb/s
Stream #0:0 : Audio : mp3, 48000 Hz, stereo, fltp, 128 kb/s
Metadata :
encoder : Lavc58.27Then pipe :
[NULL @ 0x7fd58a001e00] Unable to find a suitable output format for ’$’
$ : Invalid argumentIf I run "-i input.mp3 pipe:1", the log is :
Unable to find a suitable output format for ’pipe:1’ pipe:1 : Invalid
argumentHow do I set correct output ? And how should ffmpeg know what the output format is at all ?
-
How to make a MPEG-DASH MPD which starts the playback in the middle of the first segment ?
18 septembre 2018, par ravin.wangHere are the reproduce steps :
-
Normalize an H.264 video stream
ffmpeg -i 2.h264 -c:v libx264 -intra -r 25 -vf scale=640x360,setdar=16:9 2@25fps@intra@640x360.h264
(*) After that, I got an H.264 stream where all pictures are H.264 IDR frames, and fps is 25, resolution is 640x360, aspect-ratio is 16:9.
-
Generate an MP4 file
MP4Box -add 2@25fps@intra@640x360.h264:timescale=1000 -fps 25 2@25fps@intra@640x360.mp4
-
Make dash MP4 fragmented content, including init mp4, .m4s files and one .mpd file
MP4Box -dash 5000 -frag 5000 -dash-scale 1000 -frag-rap -segment-name ’seg_second$Number$’ -segment-timeline -profile live 2@25fps@intra@640x360.mp4
- Copy and publish all these files to a folder under one HTTPD server
-
I want to play from 4s of the first segment, and don’t display any frames before 4s, so I changed the .MPD file to modify the fields "SegmentTemplate@presentationTimeOffset", "SegmentTimeline:S@d/t", like as :
<?xml version="1.0"?>
<mpd xmlns="urn:mpeg:dash:schema:mpd:2011" minbuffertime="PT1.500S" type="static" mediapresentationduration="PT0H0M26.000S" maxsegmentduration="PT0H0M5.000S" profiles="urn:mpeg:dash:profile:isoff-live:2011">
<period duration="PT0H0M26.000S">
<adaptationset segmentalignment="true" maxwidth="640" maxheight="360" maxframerate="25" par="16:9" lang="und">
<segmenttemplate presentationtimeoffset="4000" media="seg_second$Number$.m4s" timescale="1000" startnumber="1" initialization="seg_secondinit.mp4">
<segmenttimeline>
<s d="1000" t="4000"></s>
<s d="5000" r="4"></s>
</segmenttimeline>
</segmenttemplate>
<representation mimetype="video/mp4" codecs="avc3.64101E" width="640" height="360" framerate="25" sar="1:1" startwithsap="1" bandwidth="2261831">
</representation>
</adaptationset>
</period>
</mpd> -
Play the MPD url from VLC player, or Edge browser, it always starts the the first frame of the first segment, the frames between 0s 4s are also displayed unexpectedly.
What’s wrong with my steps ? Or any other options for it ?
-