Recherche avancée

Médias (1)

Mot : - Tags -/ogv

Autres articles (88)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (4236)

  • ffmpeg + AWS Lambda issues. Won't compress full video

    7 juillet 2022, par Joesph Stah Lynn

    So I followed this tutorial to set everything up, and changed the function a bit to compress video, but no matter what I try, on larger videos (basically anything over 50-100MB), the output file will always be cut short, and depending on the encoding settings I'm using, will be cut by different amounts. I tried using the solution found here, adding a -nostdin flag to my ffmpeg command, but that also didn't seem to fix the issue.
    
Another odd thing, is no matter what I try, if I remove the '-f mpegts' flag, the output video will be 0B.
    
My Lambda function is set up with 3008MB of Memory (submitted a ticket to get my limit upped so I can use the full 10240MB available), and 2048MB of Ephemeral storage (I honestly am not sure if I need anything more than the minimum 512, but I upped it to try and fix the issue). When I check my cloudwatch logs, on really large files, it will occasionally time out, but other than that, I will get no error messages, just the standard start, end, and billable time messages.

    


    This is the code for my lambda function.

    


    import json
import os
import subprocess
import shlex
import boto3

S3_DESTINATION_BUCKET = "rw-video-out"
SIGNED_URL_TIMEOUT = 600

def lambda_handler(event, context):

    s3_source_bucket = event['Records'][0]['s3']['bucket']['name']
    s3_source_key = event['Records'][0]['s3']['object']['key']

    s3_source_basename = os.path.splitext(os.path.basename(s3_source_key))[0]
    s3_destination_filename = s3_source_basename + "-comp.mp4"

    s3_client = boto3.client('s3')
    s3_source_signed_url = s3_client.generate_presigned_url('get_object',
        Params={'Bucket': s3_source_bucket, 'Key': s3_source_key},
        ExpiresIn=SIGNED_URL_TIMEOUT)

    ffmpeg_cmd = f"/opt/bin/ffmpeg -nostdin -i {s3_source_signed_url} -f mpegts libx264 -preset fast -crf 28 -c:a copy - "
    command1 = shlex.split(ffmpeg_cmd)
    p1 = subprocess.run(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    resp = s3_client.put_object(Body=p1.stdout, Bucket=S3_DESTINATION_BUCKET, Key=s3_destination_filename)
    s3 = boto3.resource('s3')
    s3.Object(s3_source_bucket,s3_source_key).delete()

    return {
        'statusCode': 200,
        'body': json.dumps('Processing complete successfully')
    }


    


    This is the code from the solution I mentioned, but when I try using this code, I get output.mp4 not found errors

    


    def lambda_handler(event, context):
    print(event)
    os.chdir('/tmp')
    s3_source_bucket = event['Records'][0]['s3']['bucket']['name']
    s3_source_key = event['Records'][0]['s3']['object']['key']

    s3_source_basename = os.path.splitext(os.path.basename(s3_source_key))[0]
    s3_destination_filename = s3_source_basename + ".mp4"

    s3_client = boto3.client('s3')
    s3_source_signed_url = s3_client.generate_presigned_url('get_object',
        Params={'Bucket': s3_source_bucket, 'Key': s3_source_key},
        ExpiresIn=SIGNED_URL_TIMEOUT)
    print(s3_source_signed_url)
    s3_client.download_file(s3_source_bucket,s3_source_key,s3_source_key)
    # ffmpeg_cmd = "/opt/bin/ffmpeg -framerate 25 -i \"" + s3_source_signed_url + "\" output.mp4 "
    ffmpeg_cmd = f"/opt/bin/ffmpeg -framerate 25 -i {s3_source_key} output.mp4 "
    # command1 = shlex.split(ffmpeg_cmd)
    # print(command1)
    os.system(ffmpeg_cmd)
    # os.system('ls')
    # p1 = subprocess.run(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    file = 'output.mp4'
    resp = s3_client.put_object(Body=open(file,"rb"), Bucket=S3_DESTINATION_BUCKET, Key=s3_destination_filename)
    # resp = s3_client.put_object(Body=p1.stdout, Bucket=S3_DESTINATION_BUCKET, Key=s3_destination_filename)
    s3 = boto3.resource('s3')
    s3.Object(s3_source_bucket,s3_source_key).delete()
    return {
        'statusCode': 200,
        'body': json.dumps('Processing complete successfully')
    }


    


    Any help would be greatly appreciated.

    


  • compiling ffmpeg and chromaprint for android with success on some devices

    4 août 2016, par D Liebman

    I am following the recommendations of this site :

    https://bitbucket.org/phorton1/chromaprint

    From the site I have copied the multi-configure and multi-make scripts for the ffmpeg and chromaprint libraries. I have used them with recent clones of ffmpeg 3.0 and chromaprint 1.3.2 . I get working ’.so’ files for arm, x86 and armv7. I don’t have compillation problems. I load them into my app (a very simple app just to test this library) and I try it on my two devices. One is a Samsung Galaxy TabPro (SM-T320, api 19), and one is the Samsung S4 (api 21). I get the program to run on both. I can use the ’-version’ command to get the chromaprint version info. When I try to fingerprint a audio file, the software works on the older tablet, but not on the s4. On the s4 the error message is ’error decoding audio’.

    I have tried ffmpeg 0.9 as the bitbucket site suggests. I have the same problem. I have tried ffmpeg 2.7 and I thought this was working. Now I cannot get 2.7 to work. As before the code works on the api 19 device and not the s4.

    The Tab is an armeabi-v7a device and the s4 is an armeabi/armeabi-v7 device, so I thought by removing the ’armeabi’ binary I would have the same file on both machines, and they would have to work. This attempt did nothing. I am using android studio.

    Below is a list of some of my ffmpeg configurations. They are taken from the multi-configure script.

       --enable-static
       --disable-shared
       --disable-doc
       --disable-txtpages
       --disable-iconv

       --enable-memalign-hack
       --enable-debug
       --disable-avdevice
       --disable-avfilter
       --disable-swscale
       --disable-ffmpeg
       --disable-ffplay
       --disable-ffserver
       --disable-network
       --disable-muxers
       --disable-demuxers
       --enable-rdft
       --enable-demuxer=aac
       --enable-demuxer=ac3
       --enable-demuxer=ape
       --enable-demuxer=asf
       --enable-demuxer=flac
       --enable-demuxer=matroska_audio
       --enable-demuxer=mp3
       --enable-demuxer=mpc
       --enable-demuxer=mov
       --enable-demuxer=mpc8
       --enable-demuxer=ogg
       --enable-demuxer=tta
       --enable-demuxer=wav
       --enable-demuxer=wv
       --disable-bsfs
       --disable-filters
       --disable-parsers
       --enable-parser=aac
       --enable-parser=ac3
       --enable-parser=mpegaudio
       --disable-protocols
       --enable-protocol=file
       --disable-indevs
       --disable-outdevs
       --disable-encoders
       --disable-decoders
       --enable-decoder=aac
       --enable-decoder=ac3
       --enable-decoder=alac
       --enable-decoder=ape
       --enable-decoder=flac
       --enable-decoder=mp1
       --enable-decoder=mp2
       --enable-decoder=mp3
       --enable-decoder=mpc7
       --enable-decoder=mpc8
       --enable-decoder=tta
       --enable-decoder=vorbis
       --enable-decoder=wavpack
       --enable-decoder=wmav1
       --enable-decoder=wmav2
       --enable-decoder=pcm_alaw
       --enable-decoder=pcm_dvd
       --enable-decoder=pcm_f32be
       --enable-decoder=pcm_f32le
       --enable-decoder=pcm_f64be
       --enable-decoder=pcm_f64le
       --enable-decoder=pcm_s16be
       --enable-decoder=pcm_s16le
       --enable-decoder=pcm_s16le_planar
       --enable-decoder=pcm_s24be
       --enable-decoder=pcm_daud
       --enable-decoder=pcm_s24le
       --enable-decoder=pcm_s32be
       --enable-decoder=pcm_s32le
       --enable-decoder=pcm_s8
       --enable-decoder=pcm_u16be
       --enable-decoder=pcm_u16le
       --enable-decoder=pcm_u24be
       --enable-decoder=pcm_u24le
       --enable-decoder=rawvideo

    Here is some information about the s4 that I got from a system info app.

    Build Info
       Build.BOARD: MSM8960
       Build.BRAND: Verizon
       Build.DEVICE: jfltevzw
       Build.DISPLAY: LRX22C.I545VRUGOF1
       Build.PRODUCT: jfltevzw
       Build.HARDWARE: qcom
       Build.FINGERPRINT: Verizon/jfltevzw/jfltevzw:5.0.1/LRX22C/I545VRUGOF1:user/release-keys
       Build.CPU_ABI: armeabi-v7a
       Build.SUPPORTED_32_BIT_ABIS: [armeabi-v7a, armeabi]
       Build.SUPPORTED_64_BIT_ABIS: []
       Build.SUPPORTED_ABIS: [armeabi-v7a, armeabi]
       Build.HOST: SWDD6122
       Build.ID: LRX22C
       Build.MANUFACTURER: samsung
       Build.MODEL: SCH-I545
       Build.PRODUCT: jfltevzw
       Build.TAGS: release-keys
       Build.TIME: 2015-07-15T03:39:01.000-0400
       Build.TYPE: user
       Build.USER: dpi
       Build.BOOTLOADER: I545VRUGOF1
       Build.TAGS: release-keys
       Build.VERSION.CODENAME: REL
       Build.VERSION.INCREMENTAL: I545VRUGOF1
       Build.VERSION.RELEASE: 5.0.1
       Build.VERSION.SDK_INT: 21

    EDIT :

    This is the complete source for my project minus the api-key which is personal. https://github.com/radiodee1/awesome-fpcalc The code is arranged in parts inside the git repository. The ’fpcalc-testapp’ part just has the Android Studio project. The ’fpcalc-build’ part is my attempt to use the latest versions of ffmpeg, chromaprint, and kissfft. The ’fpcalc-build-complete’ part is a series of scripts that reproduces the P. Horton ffmpeg 2.7 scenario. Bye the way I believe the best libraries are produced in the ’build-complete’ folders.

  • AWS Lambda subprocess OSError : [Errno 2] No such file or directory

    11 septembre 2016, par Lev

    I’m trying to create a lambda function that makes collection of thumbnails from a video on amazon s3 using ffmpeg. ffmpeg binary is included into fuction package.

    function code :

    # -*- coding: utf-8 -*-

    import stat
    import shutil
    import boto3
    import logging
    import subprocess as sp
    import os
    import threading

    thumbnail_prefix = 'thumb_'
    thumbnail_ext = '.jpg'
    time_delta = 1
    video_frames_path = 'media/videos/frames'

    print('Loading function')
    logger = logging.getLogger()
    logger.setLevel(logging.INFO)

    lambda_tmp_dir = '/tmp'  # Lambda fuction can use this directory.

    # ffmpeg is stored with this script.
    # When executing ffmpeg, execute permission is requierd.
    # But Lambda source directory do not have permission to change it.
    # So move ffmpeg binary to `/tmp` and add permission.
    ffmpeg_bin = "{0}/ffmpeg.linux64".format(lambda_tmp_dir)
    shutil.copyfile('/var/task/ffmpeg.linux64', ffmpeg_bin)

    os.chmod(ffmpeg_bin, 777)

    # tried also:
    # os.chmod(ffmpeg_bin, os.stat(ffmpeg_bin).st_mode | stat.S_IEXEC)

    s3 = boto3.client('s3')


    def get_thumb_filename(num):
       return '{prefix}{num:03d}{ext}'.format(prefix=thumbnail_prefix, num=num, ext=thumbnail_ext)


    def create_thumbnails(video_url):
       i = 1
       filenames_list = []
       filename = None
       while i == 1 or os.path.isfile(os.path.join(os.getcwd(), get_thumb_filename(i-1))):
           if filename:
               filenames_list.append(filename)
           time = time_delta * (i - 1)
           filename = get_thumb_filename(i)
           print(ffmpeg_bin)
           if os.path.isfile(ffmpeg_bin):
               print('ok')
           sp.call(['sudo',
                    ffmpeg_bin,
                    '-ss',
                    str(time),
                    '-i',
                    video_url,
                    '-frames:v',
                    '1',
                    get_thumb_filename(i)])
           i += 1
       print(filenames_list)
       return filenames_list


    def s3_upload_file(file_path, key, bucket, acl, content_type):
       file = open(file_path, 'r')
       s3.put_object(
           Bucket=bucket,
           ACL=acl,
           Body=file,
           Key=key,
           ContentType=content_type
       )
       logger.info("file {0} moved to {1}/{2}".format(file_path, bucket, key))


    def s3_upload_files_in_threads(filenames_list, dir_path, bucket, s3path, acl, content_type):
       for filename in filenames_list:
           if os.path.isfile(os.path.join(dir_path, filename)):
               print(os.path.join(dir_path, filename))
           t = threading.Thread(target=s3_upload_file,
                                args=(os.path.join(dir_path, filename),
                                      '{0}/{1}'.format(s3path, filename),
                                      bucket,
                                      acl,
                                      content_type)).start()


    def lambda_handler(event, context):
       bucket = event['Records'][0]['s3']['bucket']['name']
       video_key = event['Records'][0]['s3']['object']['key']
       video_name = video_key.split('/')[-1].split('.')[0]
       video_url = 'http://{0}/{1}'.format(bucket, video_key)
       filenames_list = create_thumbnails(video_url)
       s3_upload_files_in_threads(filenames_list,
                                  os.getcwd(),
                                  bucket,
                                  '{0}/{1}'.format(video_frames_path, video_name),
                                  'public-read',
                                  'image/jpeg')
       return

    during the execution I get following logs :

    Loading function

    /tmp/ffmpeg.linux64

    ok

    [Errno 2] No such file or directory: OSError
    Traceback (most recent call last):
    File "/var/task/lambda_function.py", line 112, in lambda_handler
    filenames_list = create_thumbnails(video_url)
    File "/var/task/lambda_function.py", line 77, in create_thumbnails
    get_thumb_filename(i)])
    File "/usr/lib64/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
    File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
    File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
    OSError: [Errno 2] No such file or directory

    When I use the same sp.call() with the same ffmpeg binary on my ec2 instance it works fine.