Home Forums Software ELAN Problem with media clip using script

Problem with media clip using script

This topic contains 2 replies, has 2 voices, and was last updated by  Han 1 month, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
Author Posts
Author Posts
October 1, 2017 at 18:46 #11703

lhou

I have not been able to extract any media clips from ELAN using the media clip using script feature. Every time I try, nothing happens. I currently use the ELAN 5.0.0-alpha and beta versions for MacOS Sierra and have looked through the forum. I wonder if I need to edit the clip media text file. Would someone take the time to look at it? Here it is:

osascript ./scripts/qtp_clip_10_6_export.scpt $in_file $out_file $begin(sec.ms) $end(sec.ms)

# M2-edit-cl /in:$begin(fr) /out:$end(fr) $in_file $out_file
# ffmpeg.exe -vcodec copy -acodec copy -ss $begin(sec.ms) -t “$duration(sec.ms)” -i $in_file $out_file

#
# Lines starting with a # (dash) are considered to be comment lines.
#
# This is an example media clipping configuration file for use with ELAN.
# The configuration consists of the name of an application that can clip
# media files and that supports parameterized calls from the command line
# followed by a number of parameters for the application.
# The actual set of parameters depends on the application of choice.
# But most programs will need the path to an input file, the path to an output file,
# the begin time of the portion to clip and either the end time or the duration of
# the portion to clip.
#
# When creating a clip from within ELAN, it reads the script and fills the
# placeholders for the common parameters with the necessary information.
#
# The first part of the script should be the name or the path to the application
# to be used for the clipping. If only a name is used the application should be
# known to the system, “in the path”. If a path is specified it should be the
# absolute path to the application. If the absolute path contains white spaces the
# path should be within double quotation marks. If the input file and output file
# paths might contain spaces and the clipping application would need them to
# be in quotation marks these should be added before and after the placeholders
# in the script.in
#
#
# The placeholders have this form:
#
# $in_file
# $out_file
# $begin(format)
# $end(format)
# $duration(format)
#
# where format needs to be replaced by one of the following formats:
#
# hour:min:sec.ms
# hour:min:sec:fr
# hour:min:sec:fr_NTSC
# sec.ms
# ms
# fr
# fr_NTSC
#
# when frames are specified PAL is assumed, for NTSC use hour:min:sec:fr_NTSC or fr_NTSC
#
# Examples:
#
# C:\Program\ffmpeg\bin\ffmpeg.exe -i $in_file -vcodec copy -acodec copy -ss $begin(sec.ms) -t $duration(sec.ms) $out_file
# M2-edit-cl /in:$begin(fr) /out:$end(fr) $in_file $out_file

October 3, 2017 at 01:25 #11705

Han

Yes, there are several issues with this functionality on macOS. As of version 10.11 (I believe) all the libraries and resources of an application need to be inside the .app folder. If you right-click e.g. the ELAN_5.0.0-beta(.app) and choose Show Package Contents, you’ll find a lot of files in the Contents/Resources folder. Apart from the ‘clip-media.txt’ file, normally there would also be a file ‘qtp_clip_10_7_export.scpt’ there. But if we do so the .app cannot be digitally signed because the .scpt is detected as ‘junk’. They are now zipped in ‘scripts.zip’.
The best thing to do is maybe look into the ‘Clip_media_osx.pdf’ and follow the steps to copy ‘Clip-media.txt’ to ELAN’s preferences folder.
Then edit it. Either change the relevant line to call ffmpeg or extract the most recent, the 10_7 version, of the scpt archive and save it e.g in the same ELAN preferences folder and modify ‘clip-media’ by setting the absolute path to the .scpt file as the second parameter, after ‘osascript’. After saving clip-media and launching ELAN, clipping media might work.

There are still problems with the .scpt file: the time values for start and end times are read as ‘integer’ and the fractional part is removed (or rounded down to whole seconds). The arguments 3 and 4 in the .scpt file should be read as ‘real’ but then (on the system I tested on) time values in the format sec.ms are not parsed correctly when there are three decimals, as ELAN passes such time values. E.g. 12.333 is apparently not correct, 12.3 is. At this moment I don’t think there is a way to specify such format.
Maybe clipping with ffmpeg is easier now (but I haven’t checked that recently).

-Han

October 5, 2017 at 14:00 #11708

Han

I have now uploaded new versions of the two variants of AppleScript-based clipping, one that calls QuickTime’s export function and one that calls the Save As function. The first one works on a macOS 10.12 machine, the second one results in a “no permission” message at the point of saving the file (maybe someone can try that one too).
In order to use e.g. the “qtp_clip_10_10_export.scpt” version the clip-media.txt has to be modified as mentioned above. If it doesn’t work from within the ELAN .app folder, it can be tried from the ELAN Preferences folder.
The new scripts can be downloaded here.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.