
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (74)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...) -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (5846)
-
trying to figure out what's wrong in the code using ffmpeg.exe
5 octobre 2013, par timmackI'm trying to upload videos and convert it to flv format as well as capturing image as thumbnails.I'm using visual web developer 2008 express edition.I've done so many research online and found something using ffmpeg.exe so I've downloaded an ffmpeg.exe and has tried so many codes but unfortunately I'm still unable to make it work.I want to save the converted video file to a certain folder in my server as well as the captured image as for its thumbnails after uploading the video.I'm not sure if the ffmpeg.exe has the problem or my codes but I suspect it's in my codes.I need somebody to help me find out what's something missing on my codes to make it work. Here's my codes below for your reference. Thanks
protected void Button1_Click(object sender, EventArgs e)
{
//Convert the Video to flv format with FFMPEG
string ffmpegPath = Server.MapPath("~/ffmpeg/ffmpeg.exe");
string tempLocation = Server.MapPath("~/tempVideos/");
string mediaOutPath = Server.MapPath("~/Videos/");
string thumbOutPath = Server.MapPath("~/Thumbs/");
string currentFile = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
//Upload the video
string vidPath = "Videos/" + outputfile;
if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "")
{
try
{
// 10240 KB means 10MB, You can change the value based on your requirement
if (FileUpload1.PostedFile.ContentLength > 1024000000)
{
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('File is too big.')", true);
}
else
{
//then save it to the Folder
Convert(tempLocation + currentFile, mediaOutPath + currentFile, thumbOutPath + currentFile);
FileUpload1.PostedFile.SaveAs(tempLocation + currentFile);
}
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);
}
}
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('Video file has been uploaded!')", true);
FlashVideo1.VideoURL = "tempVideos/" + currentFile;
}
protected void Convert(string fileIn, string fileOut, string thumbOut)
{
try
{
string mediaOutPath = Server.MapPath("~/Videos/");
string thumbOutPath = Server.MapPath("~/Thumbs/");
string inputfile = FileUpload1.PostedFile.FileName;
string infile = Path.GetFileNameWithoutExtension(inputfile);
fileIn = Path.GetFullPath( inputfile);
fileOut = mediaOutPath + inputfile;
thumbOut = inputfile;
string ffmpegPath = Server.MapPath("~/ffmpeg/ffmpeg.exe");
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = true;
proc.StartInfo.FileName = ffmpegPath;
//converting video to flv format
proc.StartInfo.Arguments = "-i " + fileIn + "-ar 22050 -ab 32 -f flv -s 320×240 -aspect 4:3 -y" + fileOut.Split('.')[0] + ".flv";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
proc.WaitForExit();
//capturing thumbnail image of the video
proc.StartInfo.Arguments = "-i \"{0}\" -an -y -s 320x240 -ss {1} -vframes 1 -f image2 \"{2}\"" + fileIn + thumbOut.Split('.')[0] + ".jpg";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
proc.WaitForExit();
proc.Close();
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);
}
} -
extracting h264 raw video stream from mp4 or flv with ffmpeg generate an invalid stream
10 octobre 2013, par neo2006I'm trying to extract the video stream from an mp4 or flv h264 video (youtube video) using ffmpeg. The original video (test.flv) play without trouble with ffplay , ffprobe gives an error as follow :
ffprobe version N-55515-gbbbd959 Copyright (c) 2007-2013 the FFmpeg developers
built on Aug 13 2013 18:06:32 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib
libavutil 52. 42.100 / 52. 42.100
libavcodec 55. 27.100 / 55. 27.100
libavformat 55. 13.102 / 55. 13.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 82.100 / 3. 82.100
libswscale 2. 4.100 / 2. 4.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
[flv @ 000000000031ea80] Stream discovered after head already parsed
Input #0, flv, from 'test.flv':
Metadata:
starttime : 0
totalduration : 142
totaldatarate : 692
bytelength : 12286492
canseekontime : true
sourcedata : B42B95507HH1381414522145462
purl :
pmsg :
Duration: 00:02:22.02, start: 0.000000, bitrate: 692 kb/s
Stream #0:0: Video: h264 (Main), yuv420p, 640x268, 568 kb/s, 23.98 tbr, 1k t
bn, 47.95 tbc
Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp, 131 kb/s
Stream #0:2: Data: none
Unsupported codec with id 0 for input stream 2to get rid of the extra streams ( I only needs the video) I used the following ffmpeg command line :
ffmpeg -i test.flv -map 0:0 -vcodec copy -an -f h264 test.h264
The new stream is unreadable by any player including ffplay and gives an error with ffprobe :
test.h264 : Invalid data found when processing inputq= 0B f=0/0Any body have an idea about what am I doing wrong ?
I also tried simpler youtube command line :
ffmpeg -i test.flv -vcodec copy -an test.h264
if I use another format (avi for example) :
ffmpeg -i test.flv -vcodec copy -an test.avi
the output video is valid.
If I transcode the video
ffmpeg -i test.flv -an test.h264
the output is also valid
Any suggestions ?
-
What's wrong with my use of timestamps/timebases for frame seeking/reading using libav (ffmpeg) ?
17 septembre 2013, par mtreeSo I want to grab a frame from a video at a specific time using libav for the use as a thumbnail.
What I'm using is the following code. It compiles and works fine (in regards to retrieving a picture at all), yet I'm having a hard time getting it to retrieve the right picture.
I simply can't get my head around the all but clear logic behind libav's apparent use of multiple time-bases per video. Specifically figuring out which functions expect/return which type of time-base.
The docs were of basically no help whatsoever, unfortunately. SO to the rescue ?
#define ABORT(x) do {fprintf(stderr, x); exit(1);} while(0)
av_register_all();
AVFormatContext *format_context = ...;
AVCodec *codec = ...;
AVStream *stream = ...;
AVCodecContext *codec_context = ...;
int stream_index = ...;
// open codec_context, etc.
AVRational stream_time_base = stream->time_base;
AVRational codec_time_base = codec_context->time_base;
printf("stream_time_base: %d / %d = %.5f\n", stream_time_base.num, stream_time_base.den, av_q2d(stream_time_base));
printf("codec_time_base: %d / %d = %.5f\n\n", codec_time_base.num, codec_time_base.den, av_q2d(codec_time_base));
AVFrame *frame = avcodec_alloc_frame();
printf("duration: %lld @ %d/sec (%.2f sec)\n", format_context->duration, AV_TIME_BASE, (double)format_context->duration / AV_TIME_BASE);
printf("duration: %lld @ %d/sec (stream time base)\n\n", format_context->duration / AV_TIME_BASE * stream_time_base.den, stream_time_base.den);
printf("duration: %lld @ %d/sec (codec time base)\n", format_context->duration / AV_TIME_BASE * codec_time_base.den, codec_time_base.den);
double request_time = 10.0; // 10 seconds. Video's total duration is ~20sec
int64_t request_timestamp = request_time / av_q2d(stream_time_base);
printf("requested: %.2f (sec)\t-> %2lld (pts)\n", request_time, request_timestamp);
av_seek_frame(format_context, stream_index, request_timestamp, 0);
AVPacket packet;
int frame_finished;
do {
if (av_read_frame(format_context, &packet) < 0) {
break;
} else if (packet.stream_index != stream_index) {
av_free_packet(&packet);
continue;
}
avcodec_decode_video2(codec_context, frame, &frame_finished, &packet);
} while (!frame_finished);
// do something with frame
int64_t received_timestamp = frame->pkt_pts;
double received_time = received_timestamp * av_q2d(stream_time_base);
printf("received: %.2f (sec)\t-> %2lld (pts)\n\n", received_time, received_timestamp);Running this with a test movie file I get this output :
stream_time_base: 1 / 30000 = 0.00003
codec_time_base: 50 / 2997 = 0.01668
duration: 20062041 @ 1000000/sec (20.06 sec)
duration: 600000 @ 30000/sec (stream time base)
duration: 59940 @ 2997/sec (codec time base)
requested: 10.00 (sec) -> 300000 (pts)
received: 0.07 (sec) -> 2002 (pts)The times don't match. What's going on here ? What am I doing wrong ?
While searching for clues I stumbled upon this this statement from the libav-users mailing list…
[...] packet PTS/DTS are in units of the format context's time_base,
where the AVFrame->pts value is in units of the codec context's time_base.In other words, the container can have (and usually does) a different
time_base than the codec. Most libav players don't bother using the
codec's time_base or pts since not all codecs have one, but most
containers do. (This is why the dranger tutorial says to ignore AVFrame->pts)…which confused me even more, given that I couldn't find any such mention in the official docs.
Anyway, I replaced…
double received_time = received_timestamp * av_q2d(stream_time_base);
…with…
double received_time = received_timestamp * av_q2d(codec_time_base);
…and the output changed to this…
...
requested: 10.00 (sec) -> 300000 (pts)
received: 33.40 (sec) -> 2002 (pts)Still no match. What's wrong ?