
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 (74)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
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 (7144)
-
couldn't populate thumbnail on client side
8 novembre 2020, par Lokirouter.post("/thumbnail",(req,res)=>{

 let thumbsFilePath="";
 let fileDuration="";



 ffmpeg.ffprobe(req.body.filePath, function(err,metadata){
 console.dir(metadata);
 console.log('METADATA==>'+metadata);
 console.log(metadata.format.duration);

 fileDuration=metadata.format.duration;

 })

 
 ffmpeg(req.body.filePath)
 .on('filenames', function(filenames) {
 console.log('Will generate ' + filenames.join(','))
 thumbsFilePath="uploads/thumbnails/"+ filenames[0];
 })
 .on('end', function() {
 console.log('Screenshots taken');
 console.log('FILEPATH===>'+thumbsFilePath);
 console.log('FILEDURATION===>'+fileDuration);
 return res.json({success: true, thumbsFilePath , fileDuration})
 })
 .screenshots({
 // Will take screens at 20%, 40%, 60% and 80% of the video
 count: 3,
 folder: 'uploads/thumbnails/',
 size:'320x240',
 // %b input basename ( filename w/o extension )
 filename:'thumbnail-%b.png'
 });
})



the screenshots are saved perfectly and their path is also received to the client-side from
thumbsFilePath
but I cant populate it in the client-side page(react).. idk what I am doing wrong here.

here is client-side code. I used
usestate


const [FilePath, setFilePath]= useState('');
 const [Duration, setDuration] = useState('');
 const [Thumbnail, setThumbnail] = useState('');



here is an error when I try to populate img




const onDrop=(files)=>{
 let formData= new FormData();
 let config={
 header:{'content-type':'multipart/form-data'}
 }
 
 formData.append("file",files[0])
 Axios.post('http://localhost:5000/api/video/uploadFiles',formData,config)
 .then(response=>{
 console.log(response);
 if(response.data.success){
 console.log('FILEPATH==>'+response.data.filePath);
 console.log('filename==>'+response.data.fileName);
 let variable={
 filePath:response.data.filePath,
 fileName:response.data.fileName
 }
 setFilePath(response.data.filePath);
 Axios.post('http://localhost:5000/api/video/thumbnail',variable)
 .then(response=>{
 if(response.data.success){
 setDuration(response.data.fileDuration)
 setThumbnail(response.data.thumbsFilePath)
 }else{
 alert("failed to make thumbnails");
 }
 })
 }
 }).catch(err=>{
 console.log('error'+err);
 })
 }
 
 return (
 <>
 <form>
 <dropzone>
 {({getRootProps, getInputProps}) => (
 <section>
 <div classname="dropzone__container">
 <input />
 <p>Drag 'n' drop some files here, or click to select files</p>
 </div>
 </section>
 )}
</dropzone>
 
 {Thumbnail !== "" &&
 <div>
 <img src="http://stackoverflow.com/feeds/tag/{`http:/localhost:5000/server/${Thumbnail}`}" alt="haha" style='max-width: 300px; max-height: 300px' />
 </div>
 }

{data: {…}, status: 200, statusText: "OK", headers: {…}, config: {…}, …}config: {url: "http://localhost:5000/api/video/uploadFiles", method: "post", data: FormData, headers: {…}, transformRequest: Array(1), …}data: {success: true, fileName: "SampleVideo_1280x720_1mb.mp4", filePath: "uploads\SampleVideo_1280x720_1mb.mp4"}headers: {content-length: "109", content-type: "application/json; charset=utf-8"}request: XMLHttpRequest {readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, onreadystatechange: ƒ, …}status: 200statusText: "OK"__proto__: Object
UploadVideo.js:51 FILEPATH==>uploads\SampleVideo_1280x720_1mb.mp4
UploadVideo.js:52 filename==>SampleVideo_1280x720_1mb.mp4
thumbnail-SampleVideo_1280x720_1mb_1.png:1 GET http://localhost:5000/server/uploads/thumbnails/thumbnail-SampleVideo_1280x720_1mb_1.png 404 (Not Found)
but the thumbnail is in that directory..but it says not found.and it shows the "alt"(haha) in browser.`enter code here`
(C:\Users\chidori\Desktop\project\server\uploads\thumbnails\thumbnail-SampleVideo_1280x720_1mb_1.png).
</form>


sorry for messy presentation..


-
FFMPEG on AWS Lambda works selectively
20 novembre 2020, par Arindam BaralI am using FFMpeg on AWS Lambda to convert mp4 files to m3u8 format.


Here's my code :


ENCODE_SIZE = {
 '360p': ('360:640', '1000000'),
 '540p': ('540:960', '2000000'),
 '720p': ('720:1280', '5000000')
}
@app.route('/encode', methods=['GET'])
@token_required
def encodeVideo(current_user):
 try:
 userEmail = current_user.emailID
 
 courseID = request.args.get('courseID')
 fileKey = request.args.get('fileKey')
 print ('Input file key received ', fileKey)
 convType = 'all'
 if 'convType' in request.args:
 convType = request.args.get('convType')
 print ('Conv Type::::', convType)
 instiID = Course.query.filter_by(id=courseID).first().instiID
 adminEmail = Institute.query.filter_by(id=instiID).first().adminEmail
 if adminEmail != userEmail:
 return jsonify({'message': 'Not authorized'}), 403
 
 bucket = app.config['S3_CONTENT_FOLDER']
 folder = '/'.join(fileKey.split('/')[:-1])
 
 os.system('cp /var/task/ffmpeg /tmp/; chmod 755 /tmp/ffmpeg;')
 FFMPEG_STATIC = '/tmp/ffmpeg' #"/opt/bin/ffmpeg" # 
 # FFMPEG_STATIC = 'ffmpeg' #"/opt/bin/ffmpeg" # 
 
 preSignURL = getPreSignedS3URL(fileKey, bucket)
 print (preSignURL)
 
 outputFlag = []
 
 # outFileName = 'final_out.m3u8'
 outFileName = '/tmp/final_out.m3u8'
 with open(outFileName, 'a') as outFile:
 outFile.write('#EXTM3U\n')
 
 if convType == 'all':
 for ver in ENCODE_SIZE:
 print ('Starting for ver ', ver)
 outFileNameM3 = '/tmp/%s_out.m3u8' %(ver) 
 # outFileNameM3 = '%s_out.m3u8' %(ver) 
 
 subprocess.call([FFMPEG_STATIC, '-i', preSignURL, '-c:a', 'aac', '-c:v', 'libx264', '-s', ENCODE_SIZE[ver][0], '-f', 'hls', '-hls_list_size', '0', '-hls_time', '10', outFileNameM3])
 
 outFile.write('#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=%s %s\n' %(
 ENCODE_SIZE[ver][1], outFileName
 ))
 # ret = os.system(commandStr)
 # outputFlag.append(ret)
 print ('Encoding completed for ver ', ver)
 else:
 ver = convType
 outFileNameM3 = '/tmp/%s_out.m3u8' %(ver) 
 # outFileNameM3 = '%s_out.m3u8' %(ver) 

 subprocess.call([FFMPEG_STATIC, '-i', preSignURL, '-c:a', 'aac', '-c:v', 'libx264', '-s', ENCODE_SIZE[ver][0], '-f', 'hls', '-hls_list_size', '0', '-hls_time', '10', outFileNameM3]) 
 
 outFile.write('#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=%s %s\n' %(
 ENCODE_SIZE[ver][1], outFileName
 ))
 # ret = os.system(commandStr)
 # outputFlag.append(ret)
 outFile.close()
 print ('File Key Generated')
 #Upload files to s3
 streamFiles = glob.glob('/tmp/*.ts')
 print (streamFiles)
 for fl in streamFiles:
 finFileName = fl.split('/')[-1]
 fileKeyName = folder + '/' + finFileName
 uploadFileToS3(fl, fileKeyName, app.config['S3_CONTENT_FOLDER'])
 # m3u8Files = glob.glob('/tmp/*.m3u8')
 # print (m3u8Files)
 # for fl in m3u8Files:
 # finFileName = fl.split('/')[-1]
 # fileKeyName = folder + '/' + finFileName
 # uploadFileToS3(fl, fileKeyName, app.config['S3_CONTENT_FOLDER'])
 # print ('S3 upload completed')
 
 # files = glob.glob('/tmp/*')
 # for f in files:
 # os.remove(f)
 return jsonify({'message': 'Completed file encoding'}), 201
 except:
 print (traceback.format_exc())
 return jsonify({'message': 'Error in encoding file'}), 504
if __name__ == '__main__':
 app.run(debug=True,host="0.0.0.0", port=5000)




When I request for "540p", the m3u8 file gets converted perfectly.
However, when I request for "360p" and "720p", I see only the first 1 second of the video.


Please note - All the tls files are generated in all the cases. The problem is only in creation of the m3u8 playlist file.


Can someone please help in this regard ?


EDIT 1 : I am quite new to FFMPEG. So any help here will be very welcome


The log files are present here :
https://drive.google.com/file/d/1QFgi-4jDIN3f6mWLoR999mlXzZ-Ij83R/view?usp=sharing


-
scripting massive number of files with ffmpeg [closed]
2 décembre 2020, par 8LiterAlright, I've got over 5000 MP4 files in a single directory that I would ultimately like to process using ffmpeg. I've got a few different solutions that all work by themselves, but put together do not make my job any easier.
The current file list looks like this, in one single directory :


- 

- 10-1.mp4
- 10-2.mp4
- 10123-1.mp4
- 10123-2.mp4
- 10123-3.mp4
- 10123-4.mp4
- 10123-5.mp4
- 10123-6.mp4
- 102-1.mp4
- 103-1.mp4
- 103-2.mp4
- 103-3.mp4
- 107-1.mp4
- 107-2.mp4
- 107-3.mp4
- 107-4.mp4
- 107-5.mp4
- 107-6.mp4
- 11-1.mp4
- 11-2.mp4










































The ideal process I would like is the following :


A. Take however many files in the directory have a particular prefix, for example the two "11" files at the bottom, and concatenate them into a single MP4 file. The end result is a single "11.MP4"


B. Delete the original two "11-1.mp4" and "11-2.mp4", keeping only the new "11.mp4" complete file.


C. Repeat steps A-B for all other files in this directory


This is not apparently possible right now from what I can glean from other threads, but I've tested a more manual approach which is not clean OR fast, and this is what my workflow looks like in real life...


- 

- move files with same prefix into new folder (I have a working bat file that will do this for me)
- run a ffmpeg bat file to process an "output.mp4" file (I have a working bat file that will do this for me)
- delete the original files
- rename the output.mp4 file to the prefix name (i.e. 11.mp4)
- copy that file back into the new directory
- repeat steps 1-5 a thousand times.














I've also looked into creating all new directories BASED on the filename (I have a working bat file that will do this for me) and then copy my ffmpeg bat file into each directory, and run each bat file manually... but again it's a ton of work.


(FROM STEP 1 ABOVE)


@echo off
setlocal

set "basename=."
for /F "tokens=1* delims=.*" %%a in ('dir /B /A-D ^| sort /R') do (
 set "filename=%%a"
 setlocal EnableDelayedExpansion
 for /F "delims=" %%c in ("!basename!") do if "!filename:%%c=!" equ "!filename!" (
 set "basename=!filename!"
 md "!basename!"
 )
 move "!filename!.%%b" "!basename!"
 for /F "delims=" %%c in ("!basename!") do (
 endlocal
 set "basename=%%c

 )
)



(FROM STEP 2 ABOVE)


:: Create File List
del "F:\videos\*.txt" /s /f /q
for %%i in (*.mp4) do echo file '%%i'>> mylist.txt

:: Concatenate Files
ffmpeg.exe -f concat -safe 0 -i mylist.txt -c copy output.mp4



Any ideas how I can approach this ? I'm open to powershell, batch, even python if I need to.