
Recherche avancée
Médias (1)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
Autres articles (36)
-
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) (...)
-
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...) -
L’utiliser, en parler, le critiquer
10 avril 2011La première attitude à adopter est d’en parler, soit directement avec les personnes impliquées dans son développement, soit autour de vous pour convaincre de nouvelles personnes à l’utiliser.
Plus la communauté sera nombreuse et plus les évolutions seront rapides ...
Une liste de discussion est disponible pour tout échange entre utilisateurs.
Sur d’autres sites (8746)
-
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


-
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 when live streaming sends a message and exits after some frames were sent
30 octobre 2020, par jstuardowhen doing an streaming with FFMPEG all works perfectly until I get these messages and then, ffmpeg.exe exits :


av_interleaved_write_frame(): Unknown error

frame= 1224 fps=3.4 q=13.0 size= 2758kB time=00:01:21.94 bitrate= 275.8kbits/s speed=0.226x 

av_interleaved_write_frame(): Unknown error

[flv @ 000001e310e8a1c0] Failed to update header with correct duration.

[flv @ 000001e310e8a1c0] Failed to update header with correct filesize.

Error writing trailer of rtmp://example.com/s/2b32abdc-130c-43e5-997e-079e69d1fd7f: Error number -10053 occurred

frame= 1224 fps=3.4 q=13.0 Lsize= 2758kB time=00:01:21.98 bitrate= 275.6kbits/s speed=0.226x 

video:2481kB audio:221kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.084671%

[libx264 @ 000001e310ad6080] frame I:41 Avg QP:10.29 size: 57664

[libx264 @ 000001e310ad6080] frame P:1183 Avg QP:13.52 size: 148

[libx264 @ 000001e310ad6080] mb I I16..4: 100.0% 0.0% 0.0%

[libx264 @ 000001e310ad6080] mb P I16..4: 0.1% 0.0% 0.0% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:99.7%

[libx264 @ 000001e310ad6080] coded y,uvDC,uvAC intra: 10.9% 7.1% 5.4% inter: 0.0% 0.1% 0.0%

[libx264 @ 000001e310ad6080] i16 v,h,dc,p: 84% 6% 6% 4%

[libx264 @ 000001e310ad6080] i8c dc,h,v,p: 91% 6% 3% 1%

[libx264 @ 000001e310ad6080] kb/s:248.98

[aac @ 000001e310a46d40] Qavg: 108.454

Conversion failed!



Normally, the messages I received are similar to this :


frame= 1196 fps=3.4 q=13.0 size= 2692kB time=00:01:20.08 bitrate= 275.4kbits/s speed=0.227x 



Which are the expected messages. Sometimes, I received this message, but this does not cause ffmpeg.exe to exit :


Input #0, matroska,webm, from 'pipe:':

 Metadata:

 encoder : Chrome

 Duration: N/A, start: 0.000000, bitrate: N/A

 Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)

 Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 30.30 fps, 14.99 tbr, 1k tbn, 60 tbc (default)



What may be happening ? maybe it is a problem of the RTMP server ? or something is wrong with FFMPEG ?


This version of FFMPEG.EXE is for windows. The programming language is C# from where I am launching FFMPEG.EXE process.


As I told, this happens after several frames sent to the server. Only once, this problem occured after a few frames sent. That is why I suspect that the RTMP server is the problem.


EDIT : This is the command :


FFMPEG -i - -c:v libx264 -preset ultrafast -tune zerolatency -max_muxing_queue_size 1000 -bufsize 5000 -r 15 -g 30 -keyint_min 30 -x264opts keyint=30 -crf 25 -pix_fmt yuv420p -profile:v baseline -level 3 -c:a aac -b:a 22k -ar 22050 -f flv rtmp://rtmp.xxxx.yyyy



Regards
Jaime