
Recherche avancée
Médias (1)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
Autres articles (57)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)
Sur d’autres sites (5461)
-
Add watermark in video with Google Cloud function python
26 septembre 2020, par DharmeshsharmaI am adding watermark in uploaded video by http google cloud function but my code is return on ffmpeg non zero. my python code


import os
from google.cloud import storage
from subprocess import check_output
from videoprops import get_video_properties


def hello_world(request):

client = storage.Client()
bucket = client.get_bucket('bucket_name')
request_json = request.get_json()
req_data = request.get_json()
name = req_data['file']
videofile_name = req_data['file_name']
os.makedirs('/tmp/'+os.path.dirname(name), exist_ok=True)
file_name = '/tmp/' + name
output_file_name = '/tmp/' + name.split('.')[0] + '_.'+name.split('.')[1]
print(output_file_name)
logo_path = '/temp/watermark.png'
logo_name = 'watermark.png'
print('logo found')

print(file_name)

try:
 os.remove(file_name)
except OSError:
 pass

try:
 os.remove(logo_path)
except OSError:
 pass

print("File has been removed")

# Downloading the video to the cloud functions
blob = bucket.get_blob(name)
blob.download_to_filename(file_name)

blob_logo = bucket.get_blob(logo_name)
blob_logo.download_to_filename(logo_path)

print("Video Downloaded")

props = get_video_properties(file_name)

if os.path.exists(file_name):
 print("NEW MP4 EXISTS")
 # check_output('ffmpeg -itsoffset -4 -i '+file_name+' -vcodec mjpeg -vframes 1 -an -f rawvideo -s '+str(props['width'])+'x'+str(props['height'])+' '+thumbnail_file_name, shell=True)
 # thumbnail_blob = bucket.blob(os.path.dirname(name)+'/thumbnail.jpg')
 # thumbnail_blob.upload_from_filename(thumbnail_file_name)
 # 19-7-2020
 check_output('ffmpeg -i '+file_name+' -i '+logo_path +
 ' -filter_complex overlay=10:10 -codec:a copy -preset ultrafast -async 1 '+output_file_name, shell=True)
 thumbnail_blob = bucket.blob(
 os.path.dirname(name) + '/'+videofile_name)
 thumbnail_blob.upload_from_filename(output_file_name)
 # -------------------------------------
else:
 print("MP4 not created")

print("uploaded")



In this code accessing video add watermark also accessing from bucket and applying with ffmpeg and uploading.


error is :-


raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError : Command 'ffmpeg -i /tmp/Upload/Video/1060/ad69ec74-49db-4fdb-b118-d23b9468a7b8.mp4 -i /temp/watermark.png -filter_complex overlay=10:10 -codec:a copy -preset ultrafast -async 1 /tmp/Upload/Video/1060/ad69ec74-49db-4fdb-b118-d23b9468a7b8_.mp4' returned non-zero exit status 1.


-
Cloud Functions for Firebase : completing long processes without touching maximum timeout
17 février, par Scott EwingI have to transcode videos from webm to mp4 when they're uploaded to firebase storage. I have a code demo here that works, but if the uploaded video is too large, firebase functions will time out on me before the conversion is finished. I know it's possible to increase the timeout limit for the function, but that seems messy, since I can't ever confirm the process will take less time than the timeout limit.



Is there some way to stop firebase from timing out without just increasing the maximum timeout limit ?



If not, is there a way to complete time consuming processes (like video conversion) while still having each process start using firebase function triggers ?



If even completing time consuming processes using firebase functions isn't something that really exists, is there some way to speed up the conversion of fluent-ffmpeg without touching the quality that much ? (I realize this part is a lot to ask. I plan on lowering the quality if I absolutely have to, as the reason webms are being converted to mp4 is for IOS devices)



For reference, here's the main portion of the demo I mentioned. As I said before, the full code can be seen here, but this section of the code copied over is the part that creates the Promise that makes sure the transcoding finishes. The full code is only 70 something lines, so it should be relatively easy to go through if needed.



const functions = require('firebase-functions');
const mkdirp = require('mkdirp-promise');
const gcs = require('@google-cloud/storage')();
const Promise = require('bluebird');
const ffmpeg = require('fluent-ffmpeg');
const ffmpeg_static = require('ffmpeg-static');




(There's a bunch of text parsing code here, followed by this next chunk of code inside an onChange event)



function promisifyCommand (command) {
 return new Promise( (cb) => {
 command
 .on( 'end', () => { cb(null) } )
 .on( 'error', (error) => { cb(error) } )
 .run();
 })
}
return mkdirp(tempLocalDir).then(() => {
 console.log('Directory Created')
 //Download item from bucket
 const bucket = gcs.bucket(object.bucket);
 return bucket.file(filePath).download({destination: tempLocalFile}).then(() => {
 console.log('file downloaded to convert. Location:', tempLocalFile)
 cmd = ffmpeg({source:tempLocalFile})
 .setFfmpegPath(ffmpeg_static.path)
 .inputFormat(fileExtension)
 .output(tempLocalMP4File)
 cmd = promisifyCommand(cmd)
 return cmd.then(() => {
 //Getting here takes forever, because video transcoding takes forever!
 console.log('mp4 created at ', tempLocalMP4File)
 return bucket.upload(tempLocalMP4File, {
 destination: MP4FilePath
 }).then(() => {
 console.log('mp4 uploaded at', filePath);
 });
 })
 });
 });



-
Firebase function error : Cannot find ffmpeg
9 janvier 2020, par NathanI’m using the firebase storage to execute a function when a video gets uploaded to the default bucket, in the function I’m using Ffmpeg to convert the video and set some other options like size, then I want to reupload the file back to storage and I keep getting this error :
Error: Cannot find ffmpeg
at /srv/node_modules/fluent-ffmpeg/lib/processor.js:136:22
at FfmpegCommand.proto._getFfmpegPath (/srv/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14)
at FfmpegCommand.proto._spawnFfmpeg (/srv/node_modules/fluent-ffmpeg/lib/processor.js:132:10)
at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/srv/node_modules/fluent-ffmpeg/lib/capabilities.js:517:10)
at /srv/node_modules/fluent-ffmpeg/lib/capabilities.js:568:14
at nextTask (/srv/node_modules/async/dist/async.js:4578:27)
at Object.waterfall (/srv/node_modules/async/dist/async.js:4589:9)
at Object.awaitable(waterfall) [as waterfall] (/srv/node_modules/async/dist/async.js:208:32)
at FfmpegCommand.proto._checkCapabilities (/srv/node_modules/fluent-ffmpeg/lib/capabilities.js:565:11)
at /srv/node_modules/fluent-ffmpeg/lib/processor.js:298:14I have used npm install to install both fluent-ffmpeg and ffmpeg-static yet it says it cannot find it ? Here’s my code :
const ffmpeg = require('fluent-ffmpeg');
const ffmpeg_static = require('ffmpeg-static');
const {Storage} = require('@google-cloud/storage');
const fs = require('fs');
const os = require('os');
var path = require('path');
// Creates a client
const storage = new Storage({
projectId: 'projectID',
});
function promisifyCommand(command) {
return new Promise((resolve, reject) => {
command.on('end', resolve).on('error', reject).run();
});
}
exports.updatePost = functions.storage.object().onFinalize(async (object) => {
const fileBucket = object.bucket; // The Storage bucket that contains the file.
const filePath = object.name; // File path in the bucket.
const contentType = object.contentType; // File content type.
const resourceState = object.resourceState; // The resourceState is 'exists' or 'not_exists' (for file/folder deletions).
const metageneration = object.metageneration; // Number of times metadata has been generated. New objects have a value of 1.
// Get file name
const fileName = path.basename(filePath);
// Exit if this is a move or deletaion event.
if(resourceState === 'not_exists'){
console.log('This is a deletion event');
return;
}
// Download file from bucket
const bucket = storage.bucket(fileBucket);
const tempFilePath = path.join(os.tmpdir(), fileName)
// We add a '_output.flac' suffix to target audio file name. That's where we'll upload the converted audio.
const targetTempFileName = fileName.replace(/\.[^/.]+$/, "") + '_output.mp4';
const targetTempFilePath = path.join(os.tmpdir(), targetTempFileName);
const targetStorageFilePath = path.join(path.dirname(filePath), targetTempFileName);
await bucket.file(filePath).download({destination: tempFilePath});
console.log('Video downloaded locally to', tempFilePath);
// Convert the video to suitable formats
const command = ffmpeg(tempFilePath)
.setFfmpegPath(ffmpeg_static.path)
.withSize('50%')
.toFormat('mp4')
.output(targetTempFilePath);
await promisifyCommand(command);
console.log('New video created');
//Upload video again
await bucket.upload(targetTempFilePath, {destination: targetStorageFilePath});
console.log('Output video uploaded to', targetStorageFilePath);
// Delete the local file from server as it's been uploaded to storage
fs.unlinkSync(tempFilePath);
fs.unlinkSync(targetTempFilePath);
console.log('Tempory files removed.', targetTempFilePath);
});I have searched everywhere and people are also saying that running the ffmpeg module on the function will also exceed the limit very quickly and where told to use ffmpeg-static instead ?
Thanks,Nathan