
Recherche avancée
Autres articles (47)
-
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 (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras. -
Les images
15 mai 2013
Sur d’autres sites (7682)
-
FFMPEG MP4 conversion takes so long its not practical
30 avril 2018, par Chrisco420365I want to start out by saying that I’m not just stating the fact that FFMPEG to MP4 conversion is so slow, but I’m hoping someone here can help me with this as I’ve searched around and haven’t really found out what to do in order to fix my problem.
So I found a script that seems to do the job for me, it inputs several video file formats and will in turn convert to MP4 which I will later allow the web user to watch online.
Two main things are done in this script by FFMPEG, a still image is captured in .jpg format and the video is converted to MP4. After some tweaking the script seems to work but at first I thought that it wasn’t working, that it was simply halting my server.
Let me back up for a minute... I am using FFMPEG on my development server, which is really just my crappy laptop with XAMPP installed on Windows 10 and only 2GB of RAM. Once I have the site working perfectly I will move from my crappy laptop development environment to probably a entry level dedicated server hosting plan from Godaddy or other, since at first I expect the traffic to my website to be very low.
The problem I am having is I am testing out the script that I will show you, and even with a 10MB video, it takes over 2 minutes to finish. Meanwhile the upload progress bar shows 100% since the upload is in fact complete, but no message for the user to know that something is going on behind the scenes. Obviously that I can figure out how to fix myself, maybe even just put a message letting them know that it will be a few minutes. When I tried a video that is 120MB, it took over 5 minutes which means I had to not only modify my php.ini file to allow for such script execution times, but it also makes it so that I can do nothing on the website while this is happening.
Not only can I not even so much as scroll the page up or down, but if I try to open another tab and load my website it just sits there with a blank screen as if its trying to access my site. Obviously it’s because FFMPEG is using up all system resources during its conversion of the video file. If I open file explorer and click once on the video file that is being created, and continue clicking once on it I’ll see the file size of this file slowly get larger and larger, which is obvious since the file is being filled. This problem of course is with no users on it other than myself since its in its development stage, so I wonder what it will be like on a dedicated server with users online. Will the other users not be able to do anything for however many minutes until whoever is uploading a video has their video finished ?
Should it be necessary for me to increase the max execution time in the php.ini file to more than 5 minutes for a 120MB file ? What will happen if a user tries to upload a file larger than 120MB ? Should I cut them off at 500MB perhaps ?
I love the fact that my users will be able to upload videos and I can get thumbnails and even convert to MP4 to display using HTML5 but not thrilled if noone, including the user uploading the video, can use the site as the system resources are pegged. The last time I uploaded a video on YouTube I think I remember a message saying that it would take several minutes to finish but I don’t remember the website just completely stopping for several minutes. Perhaps this is because I’m running on my insignificant laptop ?
While searching for answers to this I did come across some people complaining about it being slow but didn’t find any solutions and in fact don’t think I saw people saying it completely locked up the website until finished. As I said, I’d hate for others not to be able to get to my website or be kicked off simply because someone is uploading a video.
Perhaps this is a common issue that can be resolved with a powerful enough dedicated server once I move to production ? I would greatly appreciate any and all suggestions on how to resolve this so the user may at least continue using other areas of our website, while the conversion is taking place. I can send them an alert once the conversion is finished. If there are any suggestions as to a minimum dedicated server specs that would help alleviate this from happening, I am all ears ! :) Thanks !
Here is the script that I’m currently using :
<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/includes/dbc.php');
// size input prevents buffer overrun exploits.
function sizeinput($input, $len){
(int)$len;
(string)$input;
$n = substr($input, 0,$len);
$ret = trim($n);
$out = htmlentities($ret, ENT_QUOTES);
return $out;
}
//Check the file is of correct format.
function checkfile($input){
$ext = array('mpg', 'wma', 'mov', 'flv', 'mp4', 'avi', 'qt', 'wmv', 'rm');
$extfile = substr($input['name'],-4);
$extfile = explode('.',$extfile);
$good = array();
$extfile = $extfile[1];
if(in_array($extfile, $ext)){
$good['safe'] = true;
$good['ext'] = $extfile;
}else{
$good['safe'] = false;
}
return $good;
}
$user_id = $_SESSION['user_id'];
// if the form was submitted process request if there is a file for uploading
if($_POST && array_key_exists("vid_file", $_FILES)){
//$uploaddir is for videos before conversion
$uploaddir = 'temp/';
//$live_dir is for videos after converted to flv
$live_dir = 'library/';
//$live_img is for the first frame thumbs.
$live_img = 'thumbs/';
$seed = time();
$upload = $seed;
$uploadfile = 'temp/'.$upload.'.mp4';
$vid_title = sizeinput($_POST['vidTitle'], 50);
$vid_title = sanitizeString($vid_title);
$vid_desc = sizeinput($_POST['vidDesc'], 2000);
$vid_desc = sanitizeString($vid_desc);
$vid_cat = (int)$_POST['vidCat'];
$safe_file = checkfile($_FILES['vid_file']);
if($safe_file['safe'] == 1){
if (move_uploaded_file($_FILES['vid_file']['tmp_name'], 'temp/'.$upload.'.mp4')) {
echo "File was successfully uploaded.<br />";
//$base = basename($uploadfile, $safe_file['ext']);
$new_file = $seed.'.mp4';
$new_image = $seed.'.jpg';
$new_image_path = "thumbs/".$seed.'.jpg';
$new_flv = "library/".$new_file;
//exec('ffmpeg -i '.$uploadfile.' -an -ss 00:00:01-r 1 -vframes 1 -f mjpeg -y '.$new_image_path);
exec('ffmpeg -i '.$uploadfile.' -f mjpeg -vframes 1 -s 300x300 -an '.$new_image_path.'');
//ececute ffmpeg generate flv
exec('ffmpeg -i '.$uploadfile.' -f mp4 '.$new_flv);
//execute ffmpeg and create thumb
echo 'Thank You For Your Video!<br />';
//create query to store video
$sql = "INSERT INTO videos (`user_id`, `title`,`desc`, `file`, `thumb`) VALUES('".$user_id."','".$vid_title."','".$vid_desc."','".$new_file."','".$new_image."')";
echo '<img src="http://stackoverflow.com/feeds/tag/'.$new_image_path.'" style='max-width: 300px; max-height: 300px' /><br />
<h3>'.$vid_title.'</h3>';
mysqli_query($link, $sql) or die(mysqli_error($mysql));
} else {
echo "Possible file upload attack!\n";
print_r($_FILES);
}
}else{
echo 'Invalid File Type Please Try Again. You file must be of type
.mpg, .wma, .mov, .flv, .mp4, .avi, .qt, .wmv, .rm';
}
}
?> -
Stream over serial port using FFmpeg [closed]
12 septembre 2020, par Rasoul SharifianIs it possible to stream videos over the serial port using the FFmpeg library ? Or is there any other library that can compress and stream videos over serial ports ?
Now I am using the FFmpeg library to stream videos by UDP and LAN cables, but it must stream over the serial port.


I also used a kind of Uart to ethernet converter hardware module to solve the problem and hopefully, this worked for me. But the project goal is to send video data over serial ports originally and not using some converters.


Any suggestions would be helpful.


-
FFMpeg How to extract individual audio channels from wav/.w64 and insert in .mxf with track tags
11 septembre 2018, par VinceHi my problem is I have 2 .w64 files (extended wav format) each file has 16 mono channels of audio. I want to be able to extract specific channels of audio from each of those .w64 files and insert those channels into an .mxf file as separate single channel mono audio streams and to be additionally able to set the Tag information on those audio streams. I have tried using -map and so on but it seems to take all the channels from the .w64 files and insert a single audio stream of 16 channels. I apologise in advance as I’m very new to ffmpeg and thanks in advance for any advice any of you can offer. This is all specific to command line usage on windows.
All the bestffmpeg -i "D :\Media\AUDIO_0.W64" -i "D :\media\NO_AUDIO.mxf" -c copy -map 0:0:0 -map 0:0:1 -map 0:0:2 -acodec pcm_s24le -map 1:0 "D :\media\out.mxf"
ffmpeg version N-67838-g4388e78 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 19 2014 22:02:08 with gcc 4.9.2 (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-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 54. 14.100 / 54. 14.100
libavcodec 56. 12.101 / 56. 12.101
libavformat 56. 14.100 / 56. 14.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[w64 @ 0481c580] Estimating duration from bitrate, this may be inaccurate
Input #0, w64, from 'D:\Media\AUDIO_0.W64':
Duration: 00:01:02.56, bitrate: 18432 kb/s
Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 16 channels
, s32 (24 bit), 18432 kb/s
[mxf @ 048890e0] index entry 1564 + TemporalOffset 1 = 1565, which is out of bou
nds
Input #1, mxf, from 'D:\media\NO_AUDIO.mxf':
Metadata:
uid : adab4424-2f25-4dc7-92ff-29bd000c0000
generation_uid : adab4424-2f25-4dc7-92ff-29bd000c0001
company_name : FFmpeg
product_name : OP1a Muxer
product_version : 57.56.100
product_uid : adab4424-2f25-4dc7-92ff-29bd000c0002
modification_date: 0000-01-01 00:00:00
timecode : 00:00:00:00
Duration: 00:01:02.60, start: 0.000000, bitrate: 2404 kb/s
Stream #1:0: Video: mpeg2video (4:2:2), yuv422p(tv), 1920x1080 [SAR 1:1 DAR16:9], max. 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
File 'D:\media\out.mxf' already exists. Overwrite ? [y/N] y
[mxf @ 04891c60] there must be exactly one video stream and it must be the first
one
Output #0, mxf, to 'D:\media\out.mxf':
Metadata:
encoder : Lavf56.14.100
Stream #0:0: Audio: pcm_s24le, 48000 Hz, 16 channels, s32 (24 bit), 18432 kb/s
Metadata:
encoder : Lavc56.12.101 pcm_s24le
Stream #0:1: Audio: pcm_s24le, 48000 Hz, 16 channels, s32 (24 bit), 18432 kb/s
Metadata:
encoder : Lavc56.12.101 pcm_s24le
Stream #0:2: Audio: pcm_s24le, 48000 Hz, 16 channels, s32 (24 bit), 18432 kb/s
Metadata:
encoder : Lavc56.12.101 pcm_s24le
Stream #0:3: Video: mpeg2video, yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, max. 50000 kb/s, 25 fps, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:0 -> #0:1 (pcm_s24le (native) -> pcm_s24le (native))
Stream #0:0 -> #0:2 (pcm_s24le (native) -> pcm_s24le (native))
Stream #1:0 -> #0:3 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Error
number -1 occurred