Recherche avancée

Médias (0)

Mot : - Tags -/interaction

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (27)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

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

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

    To 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 (4964)

  • Is every instance of subprocess.Popen() its own shell ?

    26 avril 2021, par saa-sof

    Background :
I'm trying to make an application that plays music via a GUI (Tkinter), Youtube_DL and FFmpeg. While the actual application is done it also requires FFmpeg to be an environment variable to work. Now, I'm trying to foolproof the creation of a "personal" FFmpeg environment variable in order to make the application portable (the last step is using pyinstaller to make a .exe file).

    


    Problem :
I'm trying to create the environment variable for FFmpeg by passing SET through subprocess.Popen :

    


    add_ffmpeg = subprocess.Popen(f"IF EXIST {path2set} SET PATH=%PATH%;{path2set}", shell=True)


    


    When I try to echo %PATH% (with Popen) the FFmpeg variable that should be present, is not. I just need to know whether or not I'm wasting my time with SET and should instead be using SETX or perhaps some other solution, I'm open to being told I did this all wrong.

    


    Relevant Code :

    


    # get any sub-directory with ffmpeg in it's name
ffmpeg = glob(f"./*ffmpeg*/")

# proceed if there is a directory
if len(ffmpeg) > 0:
    # double-check directory exists
    ffmpeg_exist = path.isdir(ffmpeg[0])

    if ffmpeg_exist:
        print("FFmpeg: Found -> Setting Up")
        
        # get the absolute path of the directories bin folder ".\ffmpeg-release-essentials.zip\bin"
        path2set = f"{path.abspath(ffmpeg[0])}\\bin\\"
        
        # add path of directory to environment variables
        add_ffmpeg = subprocess.Popen(f"IF EXIST {path2set} SET PATH=%PATH%;{path2set}", shell=True)
        add_ffmpeg.wait()
        
        # print all of the current environment variables
        list_vars = subprocess.Popen("echo %PATH%", shell=True)
        list_vars.wait()

else:
    print("FFmpeg: Missing -> Wait for Download...")
    
    # download the ffmpeg file via direct link
    wget.download("https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip")
    
    # unzip the file
    powershell = subprocess.Popen("powershell.exe Expand-Archive -Path './ffmpeg-release-essentials.zip' "
                                  "-DestinationPath './'")
    powershell.wait()

    # remove the file
    remove("./ffmpeg-release-essentials.zip")

    # get any sub-directory with ffmpeg in it's name
    ffmpeg = glob("./*ffmpeg*/")

    # double-check directory exists
    ffmpeg_exist = path.isdir(ffmpeg[0])
    
    # proceed with if it exists
    if ffmpeg_exist:
        print("FFmpeg: Found -> Setting Up")
        
        # get the absolute path of the directories bin folder ".\ffmpeg-release-essentials.zip\bin"
        path2set = f"{path.abspath(ffmpeg[0])}\\bin\\"
        
        # add path of directory to environment variables
        add_ffmpeg = subprocess.Popen(f"IF EXIST {path2set} SET PATH=%PATH%;{path2set}", shell=True)
        add_ffmpeg.wait()

        # print all of the current environment variables
        list_vars = subprocess.Popen("echo %PATH%", shell=True)
        list_vars.wait()
        
    else:
        print("Something unexplained has gone wrong.")
        exit(0)


    


  • How to compress base64 decoded video data using ffmpeg in django

    23 mai 2021, par Sudipto Sarker

    I want to upload the video/audio file in my django-channels project. So I uploaded video(base64 encoded url) from websocket connection. It is working fine. But now after decoding base64 video data I want to compress that video using ffmpeg.But it showing error like this.
''Raw : No such file or directory''
I used 'AsyncJsonWebsocketConsumer' in consumers.py file.Here is my code :
consumers.py :

    


    async def send_file_to_room(self, room_id, dataUrl, filename):
        # decoding base64 data
        format, datastr = dataUrl.split(';base64,')
        ext = format.split('/')[-1]
        file = ContentFile(base64.b64decode(datastr), name=filename)
        print(f'file: {file}')
        # It prints 'Raw content'
        output_file_name = filename + '_temp.' + ext
        ff = f'ffmpeg -i {file} -vf "scale=iw/5:ih/5" {output_file_name}'
        subprocess.run(ff,shell=True) 


    


    May be here ffmpeg can not recognize the file to be compressed. I also tried to solve this using post_save signal.

    


    signals.py :

    


    @receiver(post_save, sender=ChatRoomMessage)
def compress_video_or_audio(sender, instance, created, **kwargs):
    print("Inside signal")
    if created:
        if instance.id is None:
            print("Instance is not present")
        else:
            video_full_path = f'{instance.document.path}'
            print(video_full_path)
   // E:\..\..\..\Personal Chat Room\media\PersonalChatRoom\file\VID_20181219_134306_w5ow8F7.mp4
            output_file_name = filename + '_temp.' + extension
            ff = f'ffmpeg -i {filename} -vf "scale=iw/5:ih/5" {output_file_name}'
            subprocess.run(ff,shell=True)
            instance.document = output_file_name
            instance.save()


    


    It is also causing "E :..\Django\New_Projects\Personal : No such file or directory".
How can I solve this issue ? Any suggetions.It will be more helpful if it can be compressed before saving the object in database. Thanks in advance.

    


  • compiling ffmpeg for Mac OSX High Sierra 10.13

    29 juillet 2021, par Martin

    Hello I made an electron app that uses ffmpeg to combine audio and renders video, it works fine on windows, linux, and modern mac osx computers, but a user has reported to me that on an older version of mac osx such as High Sierra 10.13, the way that I have setup ffmpeg does not work.

    


    I have a virtual machine with High Sierra v10.13 where I install RenderTune-mac.dmg from my RenderTune releases page, then I download 2 audio files and the image from this link. I open RenderTune, and try render a video. My command to combine the audio files into a single mp3 works fine, but when I try to combine that mp3 with the image file, the ffmpeg build I have packaged with my electron app fails with this error :

    


    Command was killed with SIGABRT (Aborted): /Applications/RenderTune.app/Contents/Resources/ffmpeg -loop 1 -framerate 2 -i /Users/martin/Downloads/R-3777978-1344032418-8379.jpeg.jpg -i /Users/martin/Downloads/output-871140.mp3 -y -acodec copy -b:a 320k -vcodec libx264 -b:v 8000k -maxrate 8000k -minrate 8000k -bufsize 3M -filter:v scale=w=1920:h=1954 -preset medium -tune stillimage -crf 18 -pix_fmt yuv420p -shortest /Users/martin/Downloads/concatVideo-871140.mp4
ffmpeg version git-2021-03-24-13335df Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
  configuration: --pkgconfigdir=/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/lib/pkgconfig --prefix=/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace --pkg-config-flags=--static --extra-cflags='-I/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/include -mmacosx-version-min=10.10' --extra-ldflags='-L/Users/martinbarker/Documents/projects/rendertune-0.5.0/workspace/lib -mmacosx-version-min=10.10' --extra-libs='-lpthread -lm' --enable-static --disable-securetransport --disable-debug --disable-shared --disable-ffplay --disable-lzma --disable-doc --enable-version3 --enable-pthreads --enable-runtime-cpudetect --enable-avfilter --enable-filters --disable-libxcb --enable-gpl --enable-nonfree --disable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libx264
  libavutil      56. 66.100 / 56. 66.100
  libavcodec     58.128.100 / 58.128.100
  libavformat    58. 69.100 / 58. 69.100
  libavdevice    58. 12.100 / 58. 12.100
  libavfilter     7.107.100 /  7.107.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, image2, from '/Users/martin/Downloads/R-3777978-1344032418-8379.jpeg.jpg':
  Duration: 00:00:00.50, start: 0.000000, bitrate: 1758 kb/s
  Stream #0:0: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 590x600 [SAR 1:1 DAR 59:60], 2 fps, 2 tbr, 2 tbn, 2 tbc
Input #1, mp3, from '/Users/martin/Downloads/output-871140.mp3':
  Metadata:
    title           : My Little Grass Shack
    album           : Our Hawaii - A Collection Of Personal Favorites
    artist          : Society Of Seven
    track           : 11
    encoder         : Lavf58.69.100
  Duration: 00:06:25.59, start: 0.025057, bitrate: 320 kb/s
  Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
    Metadata:
      encoder         : Lavc58.12
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[swscaler @ 0x7fbad9167600] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x7fbad9040400] using SAR=2681/2679
dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
  Referenced from: /Applications/RenderTune.app/Contents/Resources/ffmpeg
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ____chkstk_darwin
  Referenced from: /Applications/RenderTune.app/Contents/Resources/ffmpeg
  Expected in: /usr/lib/libSystem.B.dylib

    at makeError (/Applications/Render…eca/lib/error.js:59)
    at handlePromise (/Applications/Render…/execa/index.js:114)
    at async file:/Applicat…js/newindex.js:1323


    


    These files will render fine on windows/linux and recent mac versions. In order to package ffmpeg in my electron app on mac computers I had to build a custom sandboxed version with no dynamically linked libraries. I have a .sh file that automatically downloads ffmpeg and builds it with all the necessary flags for mac computers.
https://github.com/MartinBarker/RenderTune/blob/master/buildffmpeg.sh
Inside this .sh file is where I compile ffmpeg using these flags :

    


    ./configure \
    --pkgconfigdir="$WORKSPACE/lib/pkgconfig" \
    --prefix=${WORKSPACE} \
    --pkg-config-flags="--static" \
    --extra-cflags="-I$WORKSPACE/include -mmacosx-version-min=${MACOS_MIN}" \
    --extra-ldflags="-L$WORKSPACE/lib -mmacosx-version-min=${MACOS_MIN}" \
    --extra-libs="-lpthread -lm" \
        --enable-static \
        --disable-securetransport \
        --disable-debug \
        --disable-shared \
        --disable-ffplay \
        --disable-lzma \
        --disable-doc \
        --enable-version3 \
        --enable-pthreads \
        --enable-runtime-cpudetect \
        --enable-avfilter \
        --enable-filters \
        --disable-libxcb \
        --enable-gpl \
        --enable-nonfree \
        --disable-libass \
        --enable-libfdk-aac \
        --enable-libmp3lame \
        --enable-libx264 


    


    If I try to run this script in my High Sierra VM, it fails with this message :

    


    Unknown option "-extra-libs=-lpthread"

    


    if I remove that flag it fails with a different message :

    


    Unknown option "--enable-static"

    


    I need this flag in order to release my electron app on the mac apple store, can anyone help me compile a static version of ffmpeg that works on old versions like High Sierra 10.13 as well as works on modern mac os systems ?