Recherche avancée

Médias (0)

Mot : - Tags -/médias

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

Autres articles (51)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • 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

Sur d’autres sites (7133)

  • Formatting ffmpeg arguments correctly in Swift

    22 octobre 2019, par NCrusher

    I deleted my previous post about this because I’ve gone through a lot more trial and error on it and I needed to be sure I was giving current and relevant information.

    I’m trying to create a very simple audio conversion app for MacOS using ffmpeg. Because it’s geared at audiobooks, the audio options are pretty basic.

    func conversionSelection() {
       if inputFileUrl != nil {
           let conversionChoice = conversionOptionsPopup.indexOfSelectedItem
           switch conversionChoice {
               case 1 :
                   outputExtension = ".mp3"
                   ffmpegFilters = ["-c:a libmp3lame", "-ac 1", "-ar 22050", "-q:a 9"]
               case 2 :
                   outputExtension = ".mp3"
                   ffmpegFilters = ["-c:a libmp3lame", "-ac 2", "-ar 44100", "-q:a 5"]
               case 3 :
                   outputExtension = ".mp3"
                   ffmpegFilters = ["-c:a libmp3lame", "-ac 1", "-ar 22050", "-b:a 32k"]
               case 4:
                   outputExtension = ".flac"
                   ffmpegFilters = ["-c:a flac"]
               default :
                   outputExtension = ".m4b"
                   ffmpegFilters = ["-c copy"]
           }
       }
    }

    I don’t want to inundate this post with code, but I’m not sure what all is necessary here for people to help me troubleshoot this problem. This is the code that allows me to get my input and output paths set up :

    func updateOutputText(outputString: String, outputField: NSTextField) {
       if inputFileUrl != nil && outputDirectoryUrl == nil {
           // derive output path and filename from input and tack on a new extension if a different conversion format is chosen
           let outputFileUrl = inputFileUrl!.deletingPathExtension()
           let outputPath = outputFileUrl.path
           outputFilePath = outputPath + "\(outputExtension)"
       } else if inputFileUrl != nil && outputDirectoryUrl != nil {
           // derive output directory from outputBrowseButton action, derive filename from input file, and derive output format from conversionSelection
           let outputFile = inputFileUrl!.deletingPathExtension()
           let outputFilename = outputFile.lastPathComponent
           let outputDirectory = outputDirectoryUrl!.path
           outputFilePath = outputDirectory + "/" + outputFilename + "\(outputExtension)"
       }
       outputTextDisplay.stringValue = outputFilePath
    }

    // update input and output text fields
    func updateInputText(inputString: String, inputField: NSTextField) {
       conversionSelection()
       inputTextDisplay.stringValue = inputFilePath
    }

    Everything on the Swift side appears to be working. The input and output Browse buttons work fine. The input and output file paths are written to text fields exactly as they should be. When I select a different conversion option, it updates the file extension for my output file.

    Here are my methods for actually launching ffmpeg :

    func ffmpegConvert(inputPath: String, filters: String, outputPath: String) {
       guard let launchPath = Bundle.main.path(forResource: "ffmpeg", ofType: "") else { return }
       do {
           let convertTask: Process = Process()
           convertTask.launchPath = launchPath
           convertTask.arguments = [
               "-i", inputPath,
               filters,
               outputPath
           ]
           convertTask.standardInput = FileHandle.nullDevice
           convertTask.launch()
           convertTask.waitUntilExit()
       }
    }
    @IBAction func startConversionClicked(_ sender: Any) {
       ffmpegConvert(inputPath: inputFilePath, filters: ffmpegFilters.joined(), outputPath: "outputFilePath")
    }

    The errors are coming from ffmpeg. But I’m fairly certain the PROBLEM is that I haven’t figured out how to write them so that Swift will pass them on to ffmpeg properly.

    If I use the argument arrays exactly as they are formatted above, these are my results :

    When I choose the default option (.m4b, "-c copy") I get this error :

    Unrecognized option ’c copy’. Error splitting the argument list :
    Option not found

    If I choose any of the other options (mp3 or flac), I get both a warning that reads

    Trailing options were found on the commandline.

    Then it will actually read in the metadata of my input file (so I know my input path works at least) and then it will tell me :

    At least one output file must be specified

    So while it’s reading my input file correctly, perhaps it’s not reading my output file path ?

    Moving on.

    I then put double hyphens in the argument strings, thinking that perhaps the reason ffmpeg was reading "-c copy" as "c copy" is because the hyphen is a mathematical operator. My results are as follows :

    (Still doesn’t read metadata)
    Unrecognized option ’-c copy’.
    Error splitting the argument list : Option not found

    (choosing .mp3 output options)
    (doesn’t read metadata this time)
    Unrecognized option ’-c:a libmp3lame—ac 1—ar 22050—q:a 9’.
    Error splitting the argument list : Option not found

    (choosing .flac output option)
    (doesn’t read metadata this time)
    Unrecognized option ’-c:a flac’.
    Error splitting the argument list : Option not found

    So. No help there. Time for a different approach.

    This time, I added a whitespace in front of my arguments. Results :

    (reads metadata)
    [NULL @ 0x106800000] Unable to find a suitable output format for ’ -c copy’
    -c copy : Invalid argument

    (reads metadata)
    [NULL @ 0x10b004400] Unable to find a suitable output format for ’ -c:a libmp3lame -ac 1 -ar 22050 -q:a 9’
    -c:a libmp3lame -ac 1 -ar 22050 -q:a 9 : Invalid argument

    (reads metadata)
    NULL @ 0x10580c400] Unable to find a suitable output format for ’ -c:a flac’
    -c:a flac : Invalid argument

    So, again, I have fairly decent confirmation that it’s reading my input file correctly, but possibly not my output file. Which might make sense in that the process of stringing together my output filepath is a lot more complex than the process for my input file, but I have visual confirmation that my output file path is accurate displayed in my outputTextDisplay box, which displays the outputFilePath perfectly.

    I really have no idea what isn’t working here. I’m sorry for the long post, but I’m not able to narrow the pertinent information down any further.

  • configure : Separate package name and version requirements in helper functions

    16 novembre 2016, par Diego Biurrun
    configure : Separate package name and version requirements in helper functions
    

    The unadorned package name is needed to derive package-related variable names.

    • [DBH] configure
  • Revision 36184 : - Formulaire de configuration pour pouvoir choisir de ne pas mettre les ...

    13 mars 2010, par marcimat@… — Log

    Formulaire de configuration pour pouvoir choisir de ne pas mettre les scripts du PP dans le public. - Mise à jour des scripts d’expression régulière pour la fonction .split() que l’auteur à intégré dans une librairie plus générale, reprenant .replace(), .match() aussi notamment : http://xregexp.com/ - (...)