Progress bar and ffmpeg

Is there any way to update a progress bar in xcode using applescript while doing a shell script which invokes ffmpeg. I am making an app to convert video files to MPEG-2 using ffmpeg and need it to have a progress bar as it loads.

Not sure I entirely understand what ‘progress’ you want to monitor / report on, but - assuming that you are able to detect the events, it is fairly straightforward.

tell window "Main" to tell progress indicator "MyProg" to set contents to (ThisEvent/TotalEvents) * 100

For example, if you have 20 video files being converted, then you might reasonably stick references to each of these files in a list, then update the progress bar as each of these is completed.


set VideoList to {Video1, Video2, Video3, etc.}
set TotalVideos to (count of items in VideoList)
repeat with i from 1 to TotalVideos
set ThisVideo to item i of VideoList
--do your shell script / MPEG conversion for video number i = ThisVideo
tell window "Main" to tell progress indicator "MyProg" to set contents to (i/TotalVideos) * 100
end repeat

Does that help?