@ -60,25 +60,25 @@ When exporting segments as files, LosslessCut offers you the ability to specify
The following variables are available in the template to customize the filenames:
| Avail. for cut+merge? | Variable | Type | Output |
| - | - | - | - |
| ✅ | `${FILENAME}` | `string` | The original filename *without the extension* (e.g. `Beach Trip` for a file named `Beach Trip.mp4`).
| ✅ | `${EXT}` | `string` | The extension of the file (e.g.: `.mp4`, `.mkv`).
| ✅ | `${EPOCH_MS}` | `number` | Number of milliseconds since epoch (e.g. `1680852771465`). Useful to generate a unique file name on every export to prevent accidental overwrite.
| ✅ | `${EXPORT_COUNT}` | `number` | Number of exports done since last LosslessCut launch (starts at 1).
| ✅ | `${FILE_EXPORT_COUNT}` | `number` | Number of exports done since last file was opened (starts at 1).
| ✅ | `${SEG_LABEL}` | `string` / `string[]` | The label of the segment (e.g. `Getting Lunch`). In cut+merge mode, this will be an `Array`, and you can use e.g. this code to combine all labels with a comma between: `${SEG_LABEL.filter(label => label).join(',')}`
| | `${SEG_NUM_INT}` | `number` | Segment index, as an integer (e.g. `1`, `2` or `42`). Can be used with numeric arithmetics, e.g. `${SEG_NUM_INT+100}`.
| | `${SELECTED_SEG_NUM}` | `string` | Same as `SEG_NUM`, but it counts only selected segments.
| | `${SELECTED_SEG_NUM_INT}` | `number` | Same as `SEG_NUM_INT`, but it counts only selected segments.
| | `${SEG_SUFFIX}` | `string` | If a label exists for this segment, the label will be used, prepended by `-`. Otherwise, the segment index prepended by `-seg` will be used (e.g. `-Getting_Lunch`, `-seg1`).
| | `${CUT_FROM}` | `string` | The timestamp for the beginning of the segment in `hh.mm.ss.sss` format (e.g. `00.00.27.184`).
| | `${CUT_FROM_NUM}` | `number` | Same as `${CUT_FROM}`, but numeric, meaning it can be used with arithmetics.
| | `${CUT_TO}` | `string` | The timestamp for the ending of the segment in `hh.mm.ss.sss` format (e.g. `00.00.28.000`).
| | `${CUT_TO_NUM}` | `number` | See `${CUT_FROM_NUM}`.
| | `${CUT_DURATION}` | `string` | The duration of the segment (`CUT_TO-CUT_FROM`) in `hh.mm.ss.sss` format (e.g. `00.00.28.000`).
| | `${SEG_TAGS.XX}` | `object` | Allows you to retrieve the tags for a given segment by name. If a tag is called foo, it can be accessed with `${SEG_TAGS.foo}`. Note that if the tag does not exist, it will yield the text `undefined`. You can work around this as follows: `${SEG_TAGS.foo ?? ''}`
| Avail. for merge files? | Avail. for cut+merge? | Variable | Type | Output |
| - | - | - | - | - |
| ✅ | ✅ | `${FILENAME}` | `string` | The original filename *without the extension* (e.g. `Beach Trip` for a file named `Beach Trip.mp4`). When merging files it's the *first* original file name.
| ✅ | ✅ | `${EXT}` | `string` | The extension of the file (e.g.: `.mp4`, `.mkv`).
| ✅ | ✅ | `${EPOCH_MS}` | `number` | Number of milliseconds since epoch (e.g. `1680852771465`). Useful to generate a unique file name on every export to prevent accidental overwrite.
| ✅ | ✅ | `${EXPORT_COUNT}` | `number` | Number of exports done since last LosslessCut launch (starts at 1).
| | ✅ | `${FILE_EXPORT_COUNT}` | `number` | Number of exports done since last file was opened (starts at 1).
| ✅ | ✅ | `${SEG_LABEL}` | `string` / `string[]` | The label of the segment (e.g. `Getting Lunch`). In cut+merge mode, this will be an `Array`, and you can use e.g. this code to combine all labels with a comma between: `${SEG_LABEL.filter(label => label).join(',')}`. When merging files it's each original merged file's name.
| | | `${SEG_NUM_INT}` | `number` | Segment index, as an integer (e.g. `1`, `2` or `42`). Can be used with numeric arithmetics, e.g. `${SEG_NUM_INT+100}`.
| | | `${SELECTED_SEG_NUM}` | `string` | Same as `SEG_NUM`, but it counts only selected segments.
| | | `${SELECTED_SEG_NUM_INT}` | `number` | Same as `SEG_NUM_INT`, but it counts only selected segments.
| | | `${SEG_SUFFIX}` | `string` | If a label exists for this segment, the label will be used, prepended by `-`. Otherwise, the segment index prepended by `-seg` will be used (e.g. `-Getting_Lunch`, `-seg1`).
| | | `${CUT_FROM}` | `string` | The timestamp for the beginning of the segment in `hh.mm.ss.sss` format (e.g. `00.00.27.184`).
| | | `${CUT_FROM_NUM}` | `number` | Same as `${CUT_FROM}`, but numeric, meaning it can be used with arithmetics.
| | | `${CUT_TO}` | `string` | The timestamp for the ending of the segment in `hh.mm.ss.sss` format (e.g. `00.00.28.000`).
| | | `${CUT_TO_NUM}` | `number` | See `${CUT_FROM_NUM}`.
| | | `${CUT_DURATION}` | `string` | The duration of the segment (`CUT_TO-CUT_FROM`) in `hh.mm.ss.sss` format (e.g. `00.00.28.000`).
| | | `${SEG_TAGS.XX}` | `object` | Allows you to retrieve the tags for a given segment by name. If a tag is called foo, it can be accessed with `${SEG_TAGS.foo}`. Note that if the tag does not exist, it will yield the text `undefined`. You can work around this as follows: `${SEG_TAGS.foo ?? ''}`
Your files must always include at least one unique identifer (such as `${SEG_NUM}` or `${CUT_FROM}`), and it should end in `${EXT}` (or else players might not recognise the files). For instance, to achieve a filename sequence of `Beach Trip - 1.mp4`, `Beach Trip - 2.mp4`, `Beach Trip - 3.mp4`, your format should read `${FILENAME} - ${SEG_NUM}${EXT}`. If your template gives at least two duplicate output file names, LosslessCut will revert to using the default template instead.
<Checkboxchecked={includeAllStreams}onCheckedChange={(checked)=>setIncludeAllStreams(checked===true)}label={`${t('Include all tracks?')} - ${t('If this is checked, all audio/video/subtitle/data tracks will be included. This may not always work for all file types. If not checked, only default streams will be included.')}`}/>
<Checkboxchecked={preserveMetadataOnMerge}onCheckedChange={(checked)=>setPreserveMetadataOnMerge(checked===true)}label={t('Preserve original metadata when merging? (slow)')}/>
{isOutFileNameTooLong&&(
<Alerttext={t('File name is too long and cannot be exported.')}/>
<Alerttext={t('A mismatch was detected in at least one file. You may proceed, but the resulting file might not be playable.')}/>
)}
{!enableReadFileMeta&&(
<Alerttext={t('File compatibility check is not enabled, so the merge operation might not produce a valid output. Enable "Check compatibility" below to check file compatibility before merging.')}/>
)}
</div>
{fileFormat!=null&&isMov(fileFormat)&&<Checkboxchecked={preserveMovData}onCheckedChange={(checked)=>setPreserveMovData(checked===true)}label={t('Preserve all MP4/MOV metadata?')}/>}
<Checkboxchecked={segmentsToChapters}onCheckedChange={(checked)=>setSegmentsToChapters(checked===true)}label={t('Create chapters from merged segments? (slow)')}/>
<Checkboxchecked={includeAllStreams}onCheckedChange={(checked)=>setIncludeAllStreams(checked===true)}label={`${t('Include all tracks?')} - ${t('If this is checked, all audio/video/subtitle/data tracks will be included. This may not always work for all file types. If not checked, only default streams will be included.')}`}/>
<Checkboxchecked={alwaysConcatMultipleFiles}onCheckedChange={(checked)=>setAlwaysConcatMultipleFiles(checked===true)}label={t('Always open this dialog when opening multiple files')}/>
<Checkboxchecked={preserveMetadataOnMerge}onCheckedChange={(checked)=>setPreserveMetadataOnMerge(checked===true)}label={t('Preserve original metadata when merging? (slow)')}/>
<Checkboxchecked={clearBatchFilesAfterConcat}onCheckedChange={(checked)=>setClearBatchFilesAfterConcat(checked===true)}label={t('Clear batch file list after merge')}/>
{fileFormat!=null&&isMov(fileFormat)&&<Checkboxchecked={preserveMovData}onCheckedChange={(checked)=>setPreserveMovData(checked===true)}label={t('Preserve all MP4/MOV metadata?')}/>}
<p>{t('Note that also other settings from the normal export dialog apply to this merge function. For more information about all options, see the export dialog.')}</p>
<Checkboxchecked={segmentsToChapters}onCheckedChange={(checked)=>setSegmentsToChapters(checked===true)}label={t('Create chapters from merged segments? (slow)')}/>
<Dialog.ButtonRow>
<Dialog.CloseasChild>
<DialogButtonprimary>{t('Done')}</DialogButton>
</Dialog.Close>
</Dialog.ButtonRow>
<Checkboxchecked={alwaysConcatMultipleFiles}onCheckedChange={(checked)=>setAlwaysConcatMultipleFiles(checked===true)}label={t('Always open this dialog when opening multiple files')}/>
<Dialog.CloseButton/>
</Dialog.Content>
</Dialog.Portal>
</Dialog.Root>
<Checkboxchecked={clearBatchFilesAfterConcat}onCheckedChange={(checked)=>setClearBatchFilesAfterConcat(checked===true)}label={t('Clear batch file list after merge')}/>
<div>{t('Output container format:')}</div>
<p>{t('Note that also other settings from the normal export dialog apply to this merge function. For more information about all options, see the export dialog.')}</p>
<Alerttext={t('A mismatch was detected in at least one file. You may proceed, but the resulting file might not be playable.')}/>
)}
{!enableReadFileMeta&&(
<Alerttext={t('File compatibility check is not enabled, so the merge operation might not produce a valid output. Enable "Check compatibility" below to check file compatibility before merging.')}/>
showHelpText({text: i18n.t('When merging, do you want to preserve metadata from your original file? NOTE: This may dramatically increase processing time')});
{i18n.t('The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.',{ext: extVariableFormatted})}
{i18n.t('The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.',{ext: extVariableFormatted})}
@ -174,10 +174,10 @@ export function useDialog() {
children:(
<UnorderedList>
<ListItemicon={<FaCheckCircle/>}iconColor={hasWarnings?'var(--orange-8)':'var(--green-11)'}style={{fontWeight:'bold'}}>{hasWarnings?t('Export finished with warning(s)',{count: warnings.length}):t('Export is done!')}</ListItem>
<Warningswarnings={warnings}/>
<ListItemicon={<FaInfoCircle/>}>{t('Please test the output file in your desired player/editor before you delete the source file.')}</ListItem>
<OutputIncorrectSeeHelpMenu/>
<Noticesnotices={notices}/>
<Warningswarnings={warnings}/>
</UnorderedList>
),
});
@ -192,10 +192,10 @@ export function useDialog() {
children:(
<UnorderedList>
<ListItemicon={<FaCheckCircle/>}iconColor={hasWarnings?'warning':'success'}style={{fontWeight:'bold'}}>{hasWarnings?t('Files merged with warning(s)',{count: warnings.length}):t('Files merged!')}</ListItem>
<Warningswarnings={warnings}/>
<ListItemicon={<FaInfoCircle/>}>{t('Please test the output files in your desired player/editor before you delete the source files.')}</ListItem>