Recherche avancée

Médias (91)

Autres articles (23)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Personnaliser l’affichage de mon Médiaspip

    27 mai 2013

    Vous pouvez modifier la configuration du squelette afin de personnaliser votre Médiaspip Voir aussi plus d’informations en suivant ce lien
    Comment supprimer le nombre de vues d’affichage d’un média ?
    Administrer > Gestion du squelette > Pages des articles et médias Cocher dans "Informations non affichées sur les pages de médias" les paramètres que vous ne souhaitez pas afficher.
    Comment supprimer le titre de mon Médiaspip dans le bandeau horizontal ?
    Administrer > Gestion du squelette > (...)

Sur d’autres sites (7913)

  • Error issuing complex shell command in python via subprocess

    4 juillet 2018, par user16171

    I’ve converted about 100 video tapes and now have 100 folders full of .dv files (each folder’s name is a date). In each folder, I want to combine all of the .dv files into one x265 mp4. I have figured out the ffmpeg command to do this, and I’ve written a simple Python script to traverse the folder hierarchy and print out the ffmpeg command to do each folder’s conversion. I’d like to set it up to just run each folder in series - it will take about a week to do the entire conversion, leaving me with about 5GB of video to use/post, etc. vs the 1.5TB of raw .dv files.

    The shell command looks like this :

    ffmpeg -f concat -i <(for f in FULL_PATH_TO_FILES/*.dv; do echo "file '$f'"; done) \
     -c:v libx265 -crf 28 -c:a aac -b:a 128k \
     -strict -2 FULL_PATH_TO_FILES/FOLDERNAME.mp4

    I can run that as a shell command, and it works fine. I could use the python script to generate the 100 commands and just copy and paste them into my shell one at a time. But I’d rather just have them run in series.

    I’ve tried various incarnations of os.system and subprocess.call or subprocess.Popen, and they all error.

    I build up the command and issue subprocess.call(command), which gives this error :

    "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in init
    errread, errwrite)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
    OSError : [Errno 2] No such file or directory

    I’ve also tried building up the command, as described in many of the other threads I’ve read, but it does not work, and I assume it’s because of the for-loop I have in the shell command.

    So, what’s the best way to do this ? Obviously, a shell-jockey could just tell me how to do this via the shell, but I’m more comfortable using Python to traverse the directories and build up the ffmpeg command.

    For what it’s worth, here is the whole script :

    import os
    import subprocess
    t1 = "ffmpeg -f concat -i <(for f in "
    t2 = "/*.dv; do echo \"file '$f'\"; done) -c:v libx265 -crf 28 -c:a aac -b:a 128k -strict -2 "
    t3 = ".mp4"
    rootDir = ROOTDIR
    for dirName, subdirList, fileList in os.walk(rootDir):
       S = dirName.split('/')    
       if S[-1] == "Media":
           moviename = S[-2].split(".")[0] # e.g. "19991128_Thanksgiving"
           command = t1 + dirName + t2 + dirName + "/" + moviename + t3
           if sum([".mp4" in fname for fname in fileList]) == 0: # don't bother if there is already a mp4 file in the folder
               cmd_list = [t1,dirName,t2,dirName,"/",moviename,t3]
               print command
               print
               print
               subprocess.call(command)
  • shell scripting no such file or directory

    15 mars 2018, par Toto Tata

    I wrote a shell script that calls the ffmpeg tool but when I run it, it says No such file or directory yet it does !

    Here is my script :

    #!/bin/bash

    MAIN_DIR="/media/sf_data/pipeline"

    FFMPEG_DIR="/media/sf_data/livraison_transcripts/ffmpeg-git-20180208-64bit-static"

    for file in MAIN_DIR/audio_mp3/*.mp3;
    do
       cp -p file FFMPEG_DIR;
    done

    for file in FFMPEG_DIR/*.mp3;
    do
       ./ffmpeg -i ${file%.mp3}.ogg
       sox $file -t raw --channels=1 --bits=16 --rate=16000 --encoding=signed-
    integer --endian=little ${file%.ogg}.raw;
    done

    for file in FFMPEG_DIR/*.raw;
    do
       cp -p file MAIN_DIR/pipeline/audio_raw/;
    done

    and here is the debug response :

    cp: cannot stat ‘file’: No such file or directory
    ./essai.sh: line 14: ./ffmpeg: No such file or directory
    sox FAIL formats: can't open input file `FFMPEG_DIR/*.mp3': No such file or
    directory
    cp: cannot stat ‘file’: No such file or directory

    FYI I’m running CentOS7 on VirtualBox

    Thank you

  • 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)