Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (99)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 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, par

    Multilang 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.

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (7843)

  • Add watermark in video with Google Cloud function python

    26 septembre 2020, par Dharmeshsharma

    I 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.

    


  • Videos don't play in Android Webview after resizing with avconv

    23 juillet 2020, par Verode

    I upload original mp4 video file to the server and it plays in all browsers, including Android webview app.

    


    <video class="video" controls="controls" autobuffer="autobuffer">&#xA;<source src="video.mp4" type="video/mp4">&#xA;Your browser does not support the video tag.&#xA;</source></video>&#xA;

    &#xA;

    I have read in Stackoverflow that in some cases adding "controls autobuffer" may help. But it does not help.

    &#xA;

    I tried to access video file by clicking on a link :

    &#xA;

    <a href="http://stackoverflow.com/feeds/tag/video.mp4">Video</a>&#xA;

    &#xA;

    but video does not play.

    &#xA;

    But I need to resize videos to make them smaller.

    &#xA;

    After risizing videos play in all browsers, except Android web view.&#xA;Whats wrong with this ?

    &#xA;

    $resized = exec("avconv -y -i $file -map 0 -c:v libx264 -crf 22 -filter:v scale=\"750:trunc(ow/a/2)*2\" -c:a copy $file2");&#xA;

    &#xA;

    This problem appeared after some Android or Webview update.

    &#xA;

  • Executing shell script on Google Cloud Functions

    9 juillet 2020, par João Abrantes

    I am trying to encode .mp4 videos into hls using FFmpeg.

    &#xA;

    I am using subprocess to call FFmpeg :

    &#xA;

    def transcoder(data, context):&#xA;    """Background Cloud Function to be triggered by Cloud Storage.&#xA;       This generic function logs relevant data when a file is changed.&#xA;&#xA;    Args:&#xA;        data (dict): The Cloud Functions event payload.&#xA;        context (google.cloud.functions.Context): Metadata of triggering event.&#xA;    Returns:&#xA;        None; the output is written to Stackdriver Logging&#xA;    """&#xA;    try:&#xA;        input_filename = data[&#x27;name&#x27;].split(&#x27;/&#x27;)[-1] #videos have no extension&#xA;        input_path = f&#x27;/tmp/{input_filename}&#x27;&#xA;        print(f&#x27;filename {input_filename}&#x27;)&#xA;        print(f&#x27;input_path {input_path}&#x27;)&#xA;        print(f"bucket {data[&#x27;bucket&#x27;]}")&#xA;        print(f"name {data[&#x27;name&#x27;]}")&#xA;&#xA;        outdir_path = f&#x27;/tmp/output/{input_filename}&#x27;&#xA;        os.makedirs(outdir_path, exist_ok=True)&#xA;&#xA;        bucket = client.get_bucket(data[&#x27;bucket&#x27;])&#xA;        blob = bucket.get_blob(data[&#x27;name&#x27;])&#xA;        blob.download_to_filename(input_path)&#xA;&#xA;        cmd = f&#x27;&#x27;&#x27;ffmpeg -y -i {input_path} \&#xA;              -preset ultrafast -g 60 -sc_threshold 0 \&#xA;              -map 0:0 -map 0:1 -map 0:0 -map 0:1 \&#xA;              -s:v:0 360x640 -c:v:0 libx264 -b:v:0 365k \&#xA;              -s:v:1 720x1280 -c:v:1 libx264 -b:v:1 3000k \&#xA;              -c:a copy \&#xA;              -var_stream_map "v:0,a:0 v:1,a:1" \&#xA;              -master_pl_name master.m3u8 \&#xA;              -f hls -hls_time 6 -hls_list_size 0 \&#xA;              -hls_segment_filename "{outdir_path}/%v_fileSequence%d.ts" \&#xA;              -hls_playlist_type vod \&#xA;               {outdir_path}/%v_prog_index.m3u8&#x27;&#x27;&#x27;&#xA;&#xA;        process = subprocess.Popen(cmd)&#xA;        stdout, stderr = process.communicate()&#xA;        upload_local_directory_to_gcs(outdir_path, upload_bucket, input_filename)&#xA;    except Exception as e:&#xA;        print(e)&#xA;

    &#xA;

    The problem is that I get an error :

    &#xA;

    [Errno 2] No such file or directory: &#x27;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&#x27;: &#x27;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&#x27;&#xA;

    &#xA;

    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..?

    &#xA;

    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 ?

    &#xA;

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

    &#xA;