
Recherche avancée
Autres articles (37)
-
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (6107)
-
Evolution #3560 (Fermé) : Supprimer l’option expérimentale Google Closure Compiler
4 mai 2017Fait en 3.2 par https://zone.spip.org/trac/spip-zone/changeset/104154
-
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.


-
Berlin website owners need consent for using Google Analytics
19 novembre 2019, par Joselyn Khor — Uncategorized