
Recherche avancée
Autres articles (101)
-
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela. -
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 (...) -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)
Sur d’autres sites (11885)
-
Using ffmpeg to merge video segments created by the MediaRecorder API
10 avril 2023, par Dario CimminoI am recording a live video from a webcam using mediarecorder API un chunks of 3 seconds :


startButton.addEventListener('click', () => {
navigator.mediaDevices.getUserMedia({
 video: {
 width: 1280,
 height: 720,
 frameRate: { ideal: 30, max: 30 }
 }
})
 .then(stream => {
 video.srcObject = stream;
 mediaRecorder = new MediaRecorder(stream, { mimeType: 'video/webm' });
 mediaRecorder.ondataavailable = async (event) => {
 const blob = new Blob([event.data], { type: 'video/mp4' });
 const formData = new FormData();
 formData.append('segment', blob, `segment${segmentNumber}.mp4`);

 // When a new video segment is ready
 fetch('http://localhost:3000/upload', {
 method: 'POST',
 body: formData
 })
 .then((response) => response.text())
 .then((result) => {
 console.log('Upload result:', result);
 })
 .catch((error) => {
 console.error('Error uploading video segment:', error);
 });
 //Upload data to mysql
 fetch('upload.php', {
 method: 'POST',
 body: formData
 })
 .then(response => response.text())
 .then(result => {
 console.log('Upload result to MYSQL:', result);
 })
 .catch(error => {
 console.error('Error uploading video segment to MYSQL:', error);
 });
 segmentNumber++;
 };

 mediaRecorder.start(3000);
 })
 .catch(error => {
 console.error('Error accessing camera:', error);
 });



}) ;


I am left with only the first segment playable, as is expected.


How ever when the recording stops, i'd like to merge all those segments recorded using ffmpeg (or any other) with the help of my nodeJs server.


I am having difficulty understand the parsing of mp4 files.


if I try the command :


ffmpeg -i segment1.mp4 -i segment2.mp4 -i segment3.mp4 out.mp4



I get the following error :


ffmpeg version N-110223-gb18a9c2971-20230410 Copyright (c) 2000-2023 the FFmpeg developers
 built with gcc 12.2.0 (crosstool-NG 1.25.0.152_89671bf)
 configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230410
 libavutil 58. 6.100 / 58. 6.100
 libavcodec 60. 9.100 / 60. 9.100
 libavformat 60. 4.101 / 60. 4.101
 libavdevice 60. 2.100 / 60. 2.100
 libavfilter 9. 5.100 / 9. 5.100
 libswscale 7. 2.100 / 7. 2.100
 libswresample 4. 11.100 / 4. 11.100
 libpostproc 57. 2.100 / 57. 2.100
Input #0, matroska,webm, from 'segment1.mp4':
 Metadata:
 encoder : Chrome
 Duration: N/A, start: 0.000000, bitrate: N/A
 Stream #0:0(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 30.30 fps, 30 tbr, 1k tbn (default)
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d93cf25fc0] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d93cf25fc0] moov atom not found
segment2.mp4: Invalid data found when processing input



any help or inputs are appreciated. THanks !


-
Can ffmpeg concatenate mp3 files using the process at audio-joiner.com ?
7 juin 2020, par Ed999I have a dozen or more mp3 audio files, which I need to concatenate into a single mp3 file. The files all have the same bitrate (320 kbps) and sample rate (44.1 kHz), but all of them have differing durations.



I have studied the three methods of concatenation recommended on stackoverflow (How to concatenate two MP4 files using FFmpeg). One method actually works, but when I play back the output file I find that there are noticeable audio artifacts (audible glitches) at each join point.



I've been told that this problem is caused by the input files not having identical duration. This seems likely, because I've had some successes in concatenating audio files with identical bit rate, sample rate, and duration.



I have seen, online, some much more complex scripts which are, at present, miles beyond my understanding. One solution I was directed to required a fairly deep knowledge of Python !



However, my research also included a site at audio-joiner.com - and this had the only completely successful method I've yet found, for files of non-identical duration. That site processed some of my input files, joined the multiple files into one, and the concatenated output file it produced did not have any audible glitches at the joins.



I looked into the process the site was using, hoping to get a clue as to where I've been going wrong, but the script on the site (which looks like ajax-based javascript) is too complex for me to follow.



Because the process seemed to take quite a long time, I wouldn't be too surprised to learn that the mp3 input files are being converted to some other audio format, joined, then converted back to mp3 for the output. But if so, that wouldn't put me off using the process.



Is anyone familiar with the approach being used, and can say whether it might be reproducible using ffmpeg ?



.



ADDED -



There are 7 scripts, in all, listed in the source of the relevant page :



https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.0/jquery.min.js
https://static.123apps.com/js/socket.io.js
https://static.123apps.com/js/shared_0.js
https://static.123apps.com/js/shared_1.js
https://static.123apps.com/js/ajoiner.js
https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js




.



ADDED -



The successful (javascript) function seems to be this, but it isn't obvious to me why it is succeeding (too complex for me !). Can anyone suggest what approach it is taking ? For example, is it transcoding the mp3 files to an intermediate format, and concatenating the intermediate files ?



function start_join(e){
 l("start_join():"),l(e);
 var t;
 return(t=$.parseJSON(e)) && $("#ajoiner").ajoiner("set_params",t),!0
}

function cancel_join(e){
 return l("cancel_join():"),l(e),!0
}

!function(o){
 var t={
 init:function(e){
 var t=o(this),n=o.extend({lang:{cancel:"Cancel",download:"Download"}},e);
 o(this).data("ajoiner",{o:n,tmp_i:1,pid:-1,params:{}});
 t.data("ajoiner");
 t.ajoiner("_connect"),o("body").bind("socket_connected",function(){t.ajoiner("_connect")})
 },set_params:function(e){
 var t=o(this).data("ajoiner");
 isset(e)?(e.uid=Cookies.get("uid"),t.params=e,t.params.lang_id=lang_id,t.params.host=location.hostname,t.params.hostprotocol=location.protocol,l("socket emit join:"),l(t.params),socket.emit("join",t.params)):error("set_params: params not set")
 },_connect:function(){

 var t=o(this).data("ajoiner");

 l("_connect"),socket.on("join",function(e){
 "progress"==e.message_type?(t.tmp_i,t.tmp_i++,void 0!==getObj("theSWF")&&(getObj("theSWF").set_join_progress(parseInt(e.progress_value)),l("SWF.set_join_progress("+parseInt(e.progress_value)+")")),isset(e.pid)&&(t.pid=e.pid)):"final_result"==e.message_type?(void(e.tmp_i=0)!==getObj("theSWF")&&(getObj("theSWF").join_finished(o.stringifyJSON(e)),l("SWF.join_finished('"+o.stringifyJSON(e)+"')")),last_conv_result=e):"error"==e.message_type&&l(e.error_desc)
 }
 )},_cancel_convert:function(){
 var e=o(this).data("ajoiner");
 0code>


-
Thumbnail is not created in php
21 novembre 2014, par Desipicforu BlogspotI am writing this code to create thumbnail of uploaded video. Video is successfully created but thumbnail is not crated to directory.
There is no error in apache error log file. And when i run this command in terminal thumbnail is successfully created to my directory, But it’s not working by php.
Here is my code :-
<?php
if(isset($_REQUEST['AddFiles'])){
$targetFolder = 'uploads'; //Path to the Uploads Folder
if (!empty($_FILES)) {
for($i=0;$i' . uniqid().".".$info->getExtension();
$fileParts = pathinfo($_FILES['upload_file']['name'][$i]);
if(isset($fileParts['extension'])){
//if (in_array($fileParts['extension'],$fileTypes))
{
move_uploaded_file($tempFile,$targetFile);
echo '<div class="success">'.$_FILES['upload_file']['name'][$i].' was saved successfully inside '. $_SERVER['HTTP_HOST']."/". dirname($_SERVER["REQUEST_URI"])."/".$targetFile.' Directory</div>';
$videoUrl=$_SERVER['HTTP_HOST']."/". dirname($_SERVER["REQUEST_URI"])."/".$targetFile;
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "a7630155_google";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO video (title, artist, duration,thumb_url,video)
VALUES ('".$_REQUEST['videoName']."', '".$_REQUEST['category']."','', 'john@example.com','".$videoUrl."')";
if ($conn->query($sql) === TRUE) {
// where ffmpeg is located
$ffmpeg = '/usr/bin/ffmpeg';
//video dir
$video = "http://".$videoUrl;
//where to save the image
$image = rtrim($targetFolder,'/');
//time to take screenshot at
$interval = 5;
//screenshot size
$size = '640x480';
//ffmpeg command
$cmd = "$ffmpeg -i $video -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1";
shell_exec($cmd);
echo $cmd;
exit;
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br />" . $conn->error;
}
$conn->close();
}
/*else{
echo '<div class="fail">'.$_FILES['upload_file']['name'][$i].' couldn\'t be saved because of invalid file type.</div>';
}*/
}else{
echo '<div class="fail">'.$_FILES['upload_file']['name'][$i].' couldn\'t be saved because of invalid file type.</div>';
}
}
}
}
?>
<code class="echappe-js"><script src="//code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script><script><br />
var selDiv = "";<br />
document.addEventListener("DOMContentLoaded", init, false);<br />
<br />
function init() {<br />
document.querySelector('#upload_file').addEventListener('change', handleFileSelect, false);<br />
selDiv = document.querySelector("#selectedFiles");<br />
}<br />
<br />
function handleFileSelect(e) {<br />
if(!e.target.files) return;<br />
var files = e.target.files;<br />
for(var i=0; i<files.length; i++) {<br />
var f = files[i];<br />
selDiv.innerHTML += "<div class='file_list'>"+f.name + "</div>";<br />
}<br />
$('#uploadimages').show();<br />
}<br />
<br />
$(document).ready(function(){<br />
$("#uploadTrigger").click(function(){<br />
$("#upload_file").click();<br />
}); <br />
});<br />
<br />
</script>