
Recherche avancée
Médias (1)
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (104)
-
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 (...) -
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. -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (11280)
-
Executing shell script on Google Cloud Functions
9 juillet 2020, par João AbrantesI am trying to encode .mp4 videos into hls using FFmpeg.


I am using
subprocess
to call FFmpeg :

def transcoder(data, context):
 """Background Cloud Function to be triggered by Cloud Storage.
 This generic function logs relevant data when a file is changed.

 Args:
 data (dict): The Cloud Functions event payload.
 context (google.cloud.functions.Context): Metadata of triggering event.
 Returns:
 None; the output is written to Stackdriver Logging
 """
 try:
 input_filename = data['name'].split('/')[-1] #videos have no extension
 input_path = f'/tmp/{input_filename}'
 print(f'filename {input_filename}')
 print(f'input_path {input_path}')
 print(f"bucket {data['bucket']}")
 print(f"name {data['name']}")

 outdir_path = f'/tmp/output/{input_filename}'
 os.makedirs(outdir_path, exist_ok=True)

 bucket = client.get_bucket(data['bucket'])
 blob = bucket.get_blob(data['name'])
 blob.download_to_filename(input_path)

 cmd = f'''ffmpeg -y -i {input_path} \
 -preset ultrafast -g 60 -sc_threshold 0 \
 -map 0:0 -map 0:1 -map 0:0 -map 0:1 \
 -s:v:0 360x640 -c:v:0 libx264 -b:v:0 365k \
 -s:v:1 720x1280 -c:v:1 libx264 -b:v:1 3000k \
 -c:a copy \
 -var_stream_map "v:0,a:0 v:1,a:1" \
 -master_pl_name master.m3u8 \
 -f hls -hls_time 6 -hls_list_size 0 \
 -hls_segment_filename "{outdir_path}/%v_fileSequence%d.ts" \
 -hls_playlist_type vod \
 {outdir_path}/%v_prog_index.m3u8'''

 process = subprocess.Popen(cmd)
 stdout, stderr = process.communicate()
 upload_local_directory_to_gcs(outdir_path, upload_bucket, input_filename)
 except Exception as e:
 print(e)



The problem is that I get an error :


[Errno 2] No such file or directory: 'ffmpeg -y -i /tmp/video -preset ultrafast -g 60 -sc_threshold 0 -map 0:0 -map 0:1 -map 0:0 -map 0:1 -s:v:0 360x640 -c:v:0 libx264 -b:v:0 365k -s:v:1 720x1280 -c:v:1 libx264 -b:v:1 3000k -c:a copy -var_stream_map "v:0,a:0 v:1,a:1" -master_pl_name master.m3u8 -f hls -hls_time 6 -hls_list_size 0 -hls_segment_filename "/tmp/output/video/%v_fileSequence%d.ts" -hls_playlist_type vod /tmp/output/video/%v_prog_index.m3u8': 'ffmpeg -y -i /tmp/video -preset ultrafast -g 60 -sc_threshold 0 -map 0:0 -map 0:1 -map 0:0 -map 0:1 -s:v:0 360x640 -c:v:0 libx264 -b:v:0 365k -s:v:1 720x1280 -c:v:1 libx264 -b:v:1 3000k -c:a copy -var_stream_map "v:0,a:0 v:1,a:1" -master_pl_name master.m3u8 -f hls -hls_time 6 -hls_list_size 0 -hls_segment_filename "/tmp/output/video/%v_fileSequence%d.ts" -hls_playlist_type vod /tmp/output/video/%v_prog_index.m3u8'



But I know that the input files and the output files do exist because I debugged that using
print(os.listdir(path))
so now I am wondering if the FFmpeg I call with subprocess has access to the /tmp folder..?

I know that there is a Python FFmpeg library I could use, but I don't know how to run my FFmpeg command using that library. Can you help ?


p.s. I can run this locally with success.


-
How to load font in ffmpeg through google font [duplicate]
21 octobre 2020, par Konduri Sai Adityahow to load font file in FFmpeg through web google font ?. I tried to use google font in the cmd, but it seems telling that no web font found. can anyone tell me whether we can load font through google font URL


ffmpeg -i test.png -i sample1.mp4 -y -filter_complex "[1:v]scale=1230:692[scale1];[scale1]rotate=0:c=black@0:ow=rotw(0):oh=roth(0)[rotate0];[0:v][rotate0]overlay=333.61:172.85[mediaoverlayout0];color=black@0:959x137[c1];[c1]setsar=1,drawtext=fontfile='http://fonts.gstatic.com/s/opensans/v18/mem8YaGs126MiZpBA-U1UpcaXcl0Aw.ttf':text='Double click to edit':fontsize=121.19999999999999:fontcolor=#1e8bc3:line_spacing=16.916000000000007,rotate=0:ow=rotw(0):oh=roth(0):c=black@0[rottext1];[mediaoverlayout0][rottext1]overlay=x=207.52:y=271.076:shortest=1" -pix_fmt yuv420p -t 10 ok1.mp4 



Below are logs


built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndi
o --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-lib
ass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --e
nable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-l
ibvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzvbi --enable
-libzimg
 libavutil 56. 22.100 / 56. 22.100
 libavcodec 58. 35.100 / 58. 35.100
 libavformat 58. 20.100 / 58. 20.100
 libavdevice 58. 5.100 / 58. 5.100
 libavfilter 7. 40.101 / 7. 40.101
 libswscale 5. 3.100 / 5. 3.100
 libswresample 3. 3.100 / 3. 3.100
 libpostproc 55. 3.100 / 55. 3.100
Input #0, png_pipe, from 'storage/test.png':
 Duration: N/A, bitrate: N/A
 Stream #0:0: Video: png, 1 reference frame, rgba(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
[h264 @ 0x59749c0] Reinit context to 1920x1088, pix_fmt: yuv420p
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'storage/sample1.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.17.101
 Duration: 00:00:08.12, start: 0.000000, bitrate: 820 kb/s
 Stream #1:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1920x1080 (1920x1088), 578 kb/s, 25 fps, 25 
tbr, 12800 tbn, 50 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
 Metadata:
 handler_name : #Mainconcept MP4 Sound Media Handler
-y: No such file or directory
[AVIOContext @ 0x597a480] Statistics: 10601 bytes read, 0 seeks
[AVIOContext @ 0x597a040] Statistics: 156922 bytes read, 2 seeks



-
Create hls stream in Google Cloud Functions (ffmpeg)
3 novembre 2018, par MarkusI tried for several hours with no good outcome.
I want to create an hls stream (from a mp4 video) with the help of google cloud functions.
This is what i have come up with so far :
const remoteReadStream = myBucket.file(vidPath).createReadStream();
const remoteWriteStream = myBucket.file(vidPath.replace('.mp4', '.m3u8')).createWriteStream();
var proc = ffmpeg()
.input(remoteReadStream)
// Base url
// include all the segments in the list
.addOption('-hls_time',4)
.addOption('-c:a aac')
.addOption('-ar 48000')
.addOption('-c:v h264')
.addOption('-profile:v main')
.addOption('-crf 20')
.addOption('-sc_threshold 0')
.addOption('-g 48')
.addOption('-keyint_min 48')
.addOption('-hls_playlist_type vod')
.addOption('-b:v 800k')
.addOption('-maxrate 856k')
.addOption('-bufsize 1200k')
.addOption('-b:a 96k')
.addOption('-hls_segment_filename', 'this_is_not_working_%03d.ts')
*tried gs://.../videos/$03d.ts' as well as other paths...
.outputOptions('-f hls')
.on('progress', function(progress) {
var processing_str = 'Processing:' + progress.percent + '% done';
console.log(processing_str);
})
.on('end', function() {
console.log('file has been ffmpeg succesfully');
})
.on('error', (err, stdout, stderr) => {
console.error('An error occured during encoding', err.message);
console.error('stdout:', stdout);
console.error('stderr:', stderr);
})
.pipe(remoteWriteStream, { end: true });This will give me the m3u8 file but the header files (ts files) will not be created, cause of the failure of saving them. The m3u8 file is saved, because it is a stream.
Opening ’xxx.ts’ for writing Could not write header for output file #0 (incorrect codec parameters ?)
I want to save them in the same folder, but I cannot access it by the bucket.
Does anyone know, how to ’create’ multiple files (give the excact path of my bucket) in the ffmpeg configuration ?Maybe saving them as a stream would be the answer, but i have no clue how to pass that stream (.createWriteStream() ;) as an argument.
Thanks in advance