FFmpeg scripting?

Alex Tweedly alex at tweedly.net
Wed Jun 24 07:50:58 EDT 2015


You sholdn't need to use bash directly - simply use the 'shell' feature 
on each file.

Of course, you could do just the same by putting all the commands into a 
file, and then running it from bash if that was preferable :-)

Here's a fragment of a script I use to convert jpeg files (for different 
sizes, etc.)

This assumes that it starts in a folder full of files, and creates a 
subfolder of resized files.
(And it deals with strangely named files that caused problems for 
"shell" by
    renaming the file
    using convert (part of ImageMagick)
    renaming the files back again.
I should probably have figured out all the naming / escaping needed - 
but I was in a hurry :-)

   create folder "width400"
   repeat for each line L in tFiles
      put "Converting" && L & "<br>" & CR after tOutput

      -- deal with difficult file names
      put L into K
      -- e.g. replace "&" with "XXX" in K
      rename file L to K

      if not file_exists("width400", L) then
        put "convert " & K & " -resize 400x400\> " & "width400/" & K 
into tCmd
        put shell(tCmd)
        put "do " && tCmd && the result & "<br>" & CR after tOutput
        set the defaultfolder to "width400"
        rename file K to L
        set the defaultfolder to ".."
      end if

      rename file K to L
    end repeat

-- Alex.
On 24/06/2015 07:06, Tim Selander wrote:
> Hi,
>
> Have 1,500 files of our TV program buried in an awkward file tree. I 
> want to use LC to pick out all the video files, getting  a list of 
> files with their full paths. That part I can do. Now I want to feed 
> that list of files to ffmjpeg (open source video compression program) 
> to convert to a different format.
>
> Assuming I'll have to use a bash script or something? This will be a 
> first for me.
>
> Any chance listers have used LC and ffmjpeg together, and can throw me 
> some pointers on how to do this?
>
> TIA
>
> Tim Selander
> Tokyo, Japan
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list