
Recherche avancée
Médias (3)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (35)
-
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) (...)
-
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...) -
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)
Sur d’autres sites (6295)
-
Concat mpeg-ts files to mp4 missing keyframe data
21 juillet 2022, par JonaI have written custom code to concat multiple mpeg-ts files into an mp4 video file. I've used as reference the remuxing code sample.


I'm having issues where the final output is unable to fast-forward or rewind as the video loses its information and plays the same frame till the end. But if I play from the beginning it plays fine.


I compared using ffprobe and a hex tool my custom code remuxer results to that of using the following terminal command :


ffmpeg -i "concat:input1.ts|input2.ts|input3.ts" -c copy output.mp4



To my surprise, the videos look almost identical but I'm noticing that I'm missing stss values on the MP4 header. This is where the key and intra frames are stored according to the MP4 Specs. I'm wondering if I'm missing something on my code. Please find below how I'm currently doing things.


int remuxVideos() {
 // Other code removed....
 //

 for (auto file : files) {
 if (FcStringUtils::endsWith(file.c_str(), ".ts") &&
 FC_TIMELAPSE_ACTIVE_RECORDING_FILENAME != file) {
 FcVideoStream videoStream;
 
 error = videoStream.openStream(sourceDir + "/" + file);
 if (ERROR_NO_ERROR != error) {
 break;
 }
 
 // If the format context is not yet open, we open it using the stream
 // settings.
 if (!mpFormatCtx) {
 error = openFormatContext(sourceDir + "/app.mp4", videoStream.getStream());
 if (ERROR_NO_ERROR != error) {
 break;
 }
 }
 
 // Read video stream frames and mux them back into output.
 int64_t pts = 0;
 int64_t dts = 0;
 int64_t duration = 0;
 int ret = 0;
 
 while (1) {
 ret = videoStream.readFrame(pPacket);
 if (0 > ret) {
 // Any error we are technically EOF or just an error.
 break;
 }
 
 if (pPacket->duration == AV_NOPTS_VALUE || pPacket->dts == AV_NOPTS_VALUE || pPacket->pts == AV_NOPTS_VALUE) {
 LOGE("Invalid packet time");
 continue;
 }
 
 pPacket->stream_index = 0;
 pPacket->pos = -1;
 // pPacket->flags |= AV_PKT_FLAG_KEY; // << Does not make a difference
 
 // pts and dts should increase monotonically pts should be >= dts
 pts = pPacket->pts;
 pPacket->pts += nextPts;
 dts = pPacket->dts;
 pPacket->dts += nextDts;
 duration = pPacket->duration;
 
 // Write packet to encoder.
 ret = av_interleaved_write_frame(mpFormatCtx, pPacket);
 if (0 > ret) {
 LOGE("Failed to write frame! ret=%d %s", ret, av_err2str(ret));
 break;
 }
 
 // Release packet regardless if write frame failed.
 av_packet_unref(pPacket);
 }
 
 // Update last dts and pts.
 nextDts = nextDts + dts + duration;
 nextPts = nextPts + pts + duration;
 
 videoStream.closeStream();
 }
}

if (ERROR_NO_ERROR == error) {
 av_write_trailer(mpFormatCtx);
 
 // close output
 avio_closep(&mpFormatCtx->pb);
}

av_packet_free(&pPacket);
if (mpFormatCtx) {
 mpVideoStream = nullptr;
 avformat_free_context(mpFormatCtx);
}

int openFormatContext(const std::string &output, AVStream *pSourceStream) {
 int ret = avformat_alloc_output_context2(&mpFormatCtx,
 nullptr,
 nullptr,
 output.c_str());
 if (!mpFormatCtx) {
 LOGE("Unable to output codec: %s", av_err2str(ret));
 return ret;
 }
 
 mpFormatCtx->interrupt_callback.callback = ffmpeg_interrupt_cb;
 mpFormatCtx->interrupt_callback.opaque = this;
 
 /*
 * since all input files are supposed to be identical (framerate, dimension, color format, ...)
 * we can safely set output codec values from first input file
 */
 mpVideoStream = avformat_new_stream(mpFormatCtx, nullptr);
 
 ret = avcodec_parameters_copy(mpVideoStream->codecpar, pSourceStream->codecpar);
 if (0 > ret) {
 LOGE("Failed to copy codec parameters");
 return ret;
 }
 
 mpVideoStream->codecpar->codec_tag = 0;
 
 av_dump_format(mpFormatCtx, 0, output.c_str(), 1);
 
 ret = avio_open(&mpFormatCtx->pb, output.c_str(), AVIO_FLAG_WRITE);
 if (0 > ret) {
 LOGE("Error occurred when opening output file: %s", av_err2str(ret));
 return ret;
 }
 
 ret = avformat_write_header(mpFormatCtx, nullptr);
 if (0 > ret) {
 LOGE("Error occurred when opening output file: %s", av_err2str(ret));
 return ret;
 }
 
 return 0;
}



-
php stream any mp4
3 avril 2012, par GRaecuSI'm developing a web app that converts videos and allows to play them through Flowplayer.
On the current status, I use ffmpeg to convert the videos to mp4 and qtfaststart to fix their metadata for streaming. Everything is working smoothly as I can download any converted mp4 and view it correctly.
For serving the videos to Flowplayer, I use a php file which contains the following (summarized) code :
header("Content-Type: {$mediatype}");
if ( empty($_SERVER['HTTP_RANGE']) )
{
if ( $filetype == 'flv' && $seekPos != 0 )
{
header("Content-Length: " . ($filesize + 13));
print('FLV');
print(pack('C', 1));
print(pack('C', 1));
print(pack('N', 9));
print(pack('N', 9));
}
else
{
header("Content-Length: {$filesize}");
}
$fh = fopen($filepath, "rb") or die("Could not open file: {$filepath}");
# seek to requested file position
fseek($fh, $seekPos);
# output file
while(!feof($fh))
{
# output file without bandwidth limiting
echo fread($fh, $filesize);
}
fclose($fh);
}
else //violes rfc2616, which requires ignoring the header if it's invalid
{
$fp = @fopen($file, 'rb');
$size = filesize($file); // File size
$length = $size; // Content length
$start = 0; // Start byte
$end = $size - 1; // End byte
// Now that we've gotten so far without errors we send the accept range header
/* At the moment we only support single ranges.
* Multiple ranges requires some more work to ensure it works correctly
* and comply with the spesifications: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
*
* Multirange support annouces itself with:
* header('Accept-Ranges: bytes');
*
* Multirange content must be sent with multipart/byteranges mediatype,
* (mediatype = mimetype)
* as well as a boundry header to indicate the various chunks of data.
*/
header("Accept-Ranges: 0-$length");
// header('Accept-Ranges: bytes');
// multipart/byteranges
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
if (isset($_SERVER['HTTP_RANGE']))
{
$c_start = $start;
$c_end = $end;
// Extract the range string
list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
// Make sure the client hasn't sent us a multibyte range
if (strpos($range, ',') !== false)
{
// (?) Shoud this be issued here, or should the first
// range be used? Or should the header be ignored and
// we output the whole content?
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes $start-$end/$size");
// (?) Echo some info to the client?
exit;
}
// If the range starts with an '-' we start from the beginning
// If not, we forward the file pointer
// And make sure to get the end byte if spesified
if ($range0 == '-')
{
// The n-number of the last bytes is requested
$c_start = $size - substr($range, 1);
}
else
{
$range = explode('-', $range);
$c_start = $range[0];
$c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
}
/* Check the range and make sure it's treated according to the specs.
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
*/
// End bytes can not be larger than $end.
$c_end = ($c_end > $end) ? $end : $c_end;
// Validate the requested range and return an error if it's not correct.
if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size)
{
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes $start-$end/$size");
// (?) Echo some info to the client?
exit;
}
$start = $c_start;
$end = $c_end;
$length = $end - $start + 1; // Calculate new content length
fseek($fp, $start);
header('HTTP/1.1 206 Partial Content');
}
// Notify the client the byte range we'll be outputting
header("Content-Range: bytes $start-$end/$size");
header("Content-Length: $length");
// Start buffered download
$buffer = 1024 * 8;
while(!feof($fp) && ($p = ftell($fp)) <= $end)
{
if ($p + $buffer > $end)
{
// In case we're only outputtin a chunk, make sure we don't
// read past the length
$buffer = $end - $p + 1;
}
set_time_limit(0); // Reset time limit for big files
echo fread($fp, $buffer);
flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit.
}
fclose($fp);
}Unfortunately, it is working only for the majority of the videos. For some of them, Flowplayer keeps returning Error 200, even though they were encoded correctly.
How can I fix this ? Is it a coding problem or those videos are faulty ?
-
FFMPEG - Edit Audio
9 avril 2015, par TonyLooking to edit a blip out of the beginning of a video/audio file... How can I use FFMPEG to only edit the first two seconds of the clip so that there’s no longer that blip in the audio ?
How do I ensure that all 7 audio tracks are affected by the audio filter and then how do I ensure that all 7 are also present in my output file in the same input specs ?
Complete output -
ffmpeg -i ~/Downloads/in.mov -vcodec copy -acodec pcm_s24le -q:a 0 -af "volume=enable='between(t,0,3)':volume=0" ~/Downloads/out2.mov
ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Guessed Channel Layout for Input Stream #0.2 : mono
Guessed Channel Layout for Input Stream #0.3 : mono
Guessed Channel Layout for Input Stream #0.4 : mono
Guessed Channel Layout for Input Stream #0.5 : mono
Guessed Channel Layout for Input Stream #0.6 : mono
Guessed Channel Layout for Input Stream #0.7 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '~/Downloads/in.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2014-01-16 18:02:27
Duration: 00:00:06.44, start: 0.000000, bitrate: 119128 kb/s
Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(bt709), 1920x1080, 109843 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 2997 tbn, 2997 tbc (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
encoder : Apple ProRes 422 (HQ)
timecode : 01:00:00;00
Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
Stream #0:5(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
Stream #0:6(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
Stream #0:7(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 2 channels, s32 (24 bit), 2304 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
Stream #0:8(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:28
handler_name : Apple Alias Data Handler
timecode : 01:00:00;00
File '~/Downloads/out2.mov' already exists. Overwrite ? [y/N] y
Output #0, mov, to '~/Downloads/out2.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
encoder : Lavf56.25.101
Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 109843 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 2997 tbc (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
encoder : Apple ProRes 422 (HQ)
timecode : 01:00:00;00
Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
Metadata:
creation_time : 2014-01-16 18:02:27
handler_name : Apple Alias Data Handler
encoder : Lavc56.26.100 pcm_s24le
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:7 -> #0:1 (pcm_s24le (native) -> pcm_s24le (native))
Press [q] to stop, [?] for help
frame= 193 fps=109 q=-1.0 Lsize= 88166kB time=00:00:06.43 bitrate=112155.7kbits/s
video:86349kB audio:1811kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.006946%