
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (97)
-
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 (...) -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (7073)
-
Encoding a growing video file in realtime fails prematurely
17 janvier 2023, par MacsterThis batch script is repeatedly concatenating video clips from an textfile. The output file is then beeing encoded in realtime into dash format. Unfortunately the realtime encoding will always end prematurely and I can't figure out why. From what I observed, it shouldn't be possible that the realtime encoding would catch up to the concating - which is happening each time after the duration of the clip that was just added - because I'm setting an offset, to when the encoding has to start, via timeout.


I've tried other formats like .mp4 and .h264 and other options, but nothing seems to help. So my assumption is, that there is a conflict when read/write operation is made and these operations overlap at a certain point. But how do I find out when and how to avoid it ? I haven't had the feeling that something was happening at the exact same time, when observing the command promt.



The screenshot was taken right at failing. As you can see, the concat file
queue1.webm
is already more than 10 seconds longer than the realtime encoding at its failing position. That's why I don't think it has to do with catching up too fast. It will fail randomly, so one time it fails at 25 seconds and next time it might fail at 2 minutes and 20 seconds.

To avoid the possibility of different video settings causing troubble, I'm using only one video file. I will link it here : BigBuckBunny (Mega NZ) It's a 10 sec snippet from BigBuckBunny. I hope this is legal !? But you can use what ever clip you want.


IMPORTANT : If you try to reproduce the behaviour, please make sure you make at least one entry,
likefile 'bigbuckbunny_webm.webm'
inmylist.txt
, because adding something if the file is empty is kinda broken :)

So here is the code :


Just the FFMPEG commands :


ffmpeg -f concat -i "mylist.txt" -safe 0 -c copy -f webm -reset_timestamps 1 -streaming 1 -live 1 -y queue1.webm
[..]
ffmpeg -re -i queue1.webm -c copy -map 0:v -use_timeline 1 -use_template 1 -remove_at_exit 0 -window_size 10 -adaptation_sets "id=0,streams=v" -streaming 1 -live 1 -f dash -y queue.mpd



makedir.bat


@ECHO on

:: Create new queue
IF NOT EXIST "queue1.webm" mkfifo "queue1.webm"

setlocal EnableDelayedExpansion

set string=file 'bigbuckbunny_webm.webm'
set video_path=""
SET /a c=0
set file=-1
set file_before=""

:loop
::Get last entry from "mylist.txt"
for /f "delims=" %%a in ('type mylist.txt ^| findstr /b /c:"file"') do (
 set video_path=%%a
)
echo %video_path%

::Insert file 'bigbuckbunny_webm.webm' if mylist.txt is empty.
if "%video_path%" EQU """" (echo %string% >> mylist.txt && set file=%string:~6,-1%) else (set file=%video_path:~6,-1%)

::Insert file 'bigbuckbunny_webm.webm' into mylit.txt if actual entry(%file%) is the same than before(file 'bigbuckbunny_webm.webm').
if "%file%" EQU "%file_before%" (echo. >> mylist.txt && echo %string%>>mylist.txt) 

echo %file%

::Get the video duration
for /f "tokens=1* delims=:" %%a in ('ffmpeg -i %file% 2^>^&1 ^| findstr "Duration"') do (set duration=%%b)
echo %duration%

::Crop format to HH:MM:SS
set duration=%duration:~1,11%
echo %duration%

::Check if seconds are double digits, less than 10, like 09. Then use only 9.
if %duration:~6,1% EQU 0 (
 set /a sec=%duration:~7,1% 
 ) else ( 
 set /a sec=%duration:~6,2%

)
echo %sec%

::Convert duration into seconds
set /a duration=%duration:~0,2%*3600+%duration:~3,2%*60+%sec%
echo %duration%

::echo %duration%

::Increase iteration count.
set /a c=c+1

::Add new clip to queue.
ffmpeg -f concat -i "mylist.txt" -safe 0 -c copy -f webm -reset_timestamps 1 -streaming 1 -live 1 -y queue1.webm

::Start realtime encoding queue1, if a first clip was added.
if !c! EQU 1 (
 start cmd /k "startRealtimeEncoding.bat"
)

::Wait the duration of the inserted video 
timeout /t %duration%

::Set the actual filename as the previous file for the next iteration.
set file_before=%file%

::Stop after c loops.
if !c! NEQ 20 goto loop

echo %c%

endlocal

:end 



startRealtimeEncoding.bat


@ECHO off

timeout /t 5
ffmpeg -re -i queue1.webm -c copy -map 0:v -seg_duration 2 -keyint_min 48 -use_timeline 1 -use_template 1 -remove_at_exit 0 -window_size 10 -adaptation_sets "id=0,streams=v" -streaming 1 -live 1 -f dash -y queue.mpd

:end



-
On WebP and Academic Exercises
2 octobre 2010, par Multimedia Mike — GeneralYesterday, Google released a new still image format called WebP. To those skilled in the art, this new format will be recognizable as a single VP8 golden frame with a 20-byte header slapped on the front (and maybe a little metadata thrown in for good measure). We have a MultimediaWiki page and a sample ready to go.
Further, I submitted a patch to ffmpeg-devel for FFmpeg’s img2 handling system to decode these files. FFmpeg should support processing these files soon… if anyone cares. This leads into…
The Point, or Lack Thereof
Since yesterday’s release, I have read a whirlwind of commentary about this format, much of it critical and of the “what’s the point ?” variety. For my part, I can respect academic exercises, a.k.a., just trying random stuff to see if you can make it work. That’s pretty much this blog’s entire raison d’être. But WebP transcends mere academic exercise ; Google seems to be trying to push it as a new web standard. I don’t see how the format can go anywhere based on criticisms raised elsewhere — e.g., see Dark Shikari’s thoughtful write-up — which basically boil down to WebP not solving any real problems, technical, legal, or otherwise.How did WebP come to be ? I strongly suspect some engineers noticed that JPEG is roughly the same as an MPEG-1 intraframe, so why not create a new still frame format based on VP8 intraframes ? Again, I can respect that thinking– I have pondered how a still image format would perform if based on VP3/Theora or Sorenson Video 1.
Technically
Google claims a significant size savings for WebP vs. standard JPEG. Assuming that’s true (and there will be no shortage of blog posts to the contrary), it will still be some time before WebP support will find its way into the majority of the web browser population.But this got me thinking about possible interim solutions. A website could store images compressed in both formats if it so chose. Then it could serve up a WebM image if the browser could support it, as indicated by the ‘Accept’ header in the HTTP request. It seems that a website might have to reference a generic image name such as
<img src="some-picture.image">
; the web server would have to recognize the .image extension and map it to either a .jpg or a .webp image depending on what the browser claims it is capable of displaying.Leftovers
I appreciate that Dark Shikari has once again stuck his neck out and made a valiant — though often futile — effort to educate the internet’s masses. I long ago resigned myself to the fact that many people aren’t going to understand many of the most basic issues surrounding multimedia technology (i.e., moving pictures synchronized with audio). But apparently, this extends to still image formats as well. It was simultaneously humorous and disheartening to see commenters who don’t even understand the application of, e.g., PNG vs. JPEG : Ahem, “We already have a great replacement for jpg : .PNG”. Coupled with the typical accusations of MPEG tribalism, I remain impressed D. Shikari finds the will to bother.Still, I appreciate that the discussion has introduced me to some new image formats of which I was previously unaware, such as PGF and JPEG XR.
-
FFMPEG remove metadata from audio Libav AVStream
23 décembre 2019, par M_a_t_TWhen attempting to decode audio files using the Libav API I am experiencing issues with what I believe is metadata in the audio AVStream.
I am using this code to try and achieve this :
#include
#include
#include
#include <iostream>
extern "C" {
#include <libavformat></libavformat>avformat.h>
}
#define AUDIO_INBUF_SIZE 20480
#define AUDIO_REFILL_THRESH 4096
using namespace std;
int main(void)
{
AVFormatContext *formatContext = nullptr;
AVPacket avpkt;
uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
if(avformat_open_input(&formatContext, path_to_file, nullptr, nullptr) < 0){
cout << "Error opening file" << endl;
}
if (avformat_find_stream_info(formatContext, nullptr) != 0){
cout << "Error finding stream info" << endl;
}
av_dump_format(formatContext, 0, path_to_file, 0);
// Find the stream and its codec
AVCodec* audioCodec = nullptr;
int audioStreamIndex = av_find_best_stream(
formatContext, // The media stream
AVMEDIA_TYPE_AUDIO, // The type of stream we are looking for - audio for example
-1, // Desired stream number, -1 for any
-1, // Number of related stream, -1 for none
&audioCodec, // Gets the codec associated with the stream, can be NULL
0 // Flags - not used currently
);
cout << "Stream start time: " << std::to_string(formatContext->start_time) << endl;
if(audioStreamIndex == AVERROR_STREAM_NOT_FOUND) {
cout << "Error finding audio stream" << endl;
}
else if (!audioCodec) {
cout << "Error finding audio codec" << endl;
}
AVCodecContext *codecContext = avcodec_alloc_context3(audioCodec);
if (!codecContext){
// Out of memory
avformat_close_input(&formatContext);
}
// Set the parameters of the codec context from the stream
int result = avcodec_parameters_to_context(
codecContext,
formatContext->streams[audioStreamIndex]->codecpar
);
if(result < 0){
cout << "Failed to set parameters" << endl;
avformat_close_input(&formatContext);
avcodec_free_context(&codecContext);
}
// Ready to open stream based on previous parameters
// Third parameter (NULL) is optional dictionary settings
if (avcodec_open2(codecContext, audioCodec, NULL) < 0){
cout << "Error cannot open codec" << endl;
codecContext = nullptr;
}
av_init_packet(&avpkt); // set fields of avpkt to default.
if(av_read_frame(formatContext, &avpkt) < 0){
cout << "Error nothing read" << endl;
}
cout << "decoding..." << endl;
int sendPacketResult = avcodec_send_packet(codecContext, &avpkt);
if (sendPacketResult == AVERROR(EAGAIN)){
// Decoder can't take packets right now. Make sure you are draining it.
cout << "Decoder can not take packets rn" << endl;
} else if (sendPacketResult < 0){
// Failed to send the avpkt to the decoder
cout << "Failed to send the avpkt to the decoder" << endl;
}
AVFrame *frame = av_frame_alloc();
// Get decoded frame from decoder
int decodeFrame = avcodec_receive_frame(codecContext, frame);
if (decodeFrame == AVERROR(EAGAIN)){
// The decoder doesn't have enough data to produce a frame
// Not an error unless we reached the end of the stream
// Just pass more packets until it has enough to produce a frame
cout << "Frame not produced from decoder" << endl;
av_frame_unref(frame);
av_freep(frame);
}else if (decodeFrame < 0){
// Failed to get a frame from the decoder4
cout << "Error no frame from decoder" << endl;
av_frame_unref(frame);
av_freep(frame);
}
</iostream>Build using :
g++ test.cpp -lswscale -lavdevice -lavformat -lavcodec -lavutil -lswscale -lswresample -lpthread -lbz2 -lm -lz -lmp3lame -lx264 -lfaad -o test
Note I have constructed this from examples and looking through the ffmpeg sourcecode (4.2.1) to try and decode a single packet from an audio file.
Running this on a mp3 file which contains metadata yields the error
[mp3float @ 0x557450f9cec0] Header missing
, which I believe is due toavpkt
containing stream metadata. When running this on a mp3 file which has been stripped of metadata the packet is decoded successfully.My question is whether this is due to the metadata and if so, how to use the API so that
av_read_frame
ignores metadata and only constructs AVPackets containing legal audio data, irrespective of the encoding format of the audio file.