Batch Trim videos using Range Seconds

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
tdepke
Posts: 5
Joined: Tue Jan 03, 2023 10:23 pm

Batch Trim videos using Range Seconds

Post by tdepke »

Description of problem or question:

I'm looking to trim 50-100+ files at a time only looking to trim 2-10 seconds of each one. When I try this in the GUI after loading a folder as the source, only the first Title in the folder has the range applied to it. Is there a way to apply this range to all the files in the folder and add all to the queue without having to click each individual title and select the range for each one individually? In the steps below I'm looking to make new video files that are only the first two seconds of the original files.

Steps to reproduce the problem (If Applicable):
Open Source
Folder (Batch Scan)
With Title 1 Selected...
Set Range to Seconds The select 00:00:00 00:00:02 to only process the first two seconds of the video file
Add All to Queue



HandBrake version (e.g., 1.0.0):

1.6.0 (2022122800)


Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

Windows 10


HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all

HandBrake 1.6.0 (2022122800)
OS: Microsoft Windows NT 10.0.19044.0
CPU: Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
Ram: 16322 MB, 
GPU Information:
  NVIDIA GeForce GT 650M - 25.21.14.2531
Screen: 1920x1080
Temp Dir: C:\Users\Tyler\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake\
Data Dir: C:\Users\Tyler\AppData\Roaming\HandBrake

-------------------------------------------
[17:27:21] hb_init: starting libhb thread

 # Starting Scan ...

[17:27:21] CPU: Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
[17:27:21]  - Intel microarchitecture Ivy Bridge
[17:27:21]  - logical processor count: 8
[17:27:21] Intel Quick Sync Video support: no
[17:27:21] hb_scan: path=D:\Video\Squash Videos\3-9-21, title_index=0
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
[17:27:21] bd: not a bd - trying as a stream/file instead
libdvdread: Could not open input:
libdvdread: Can't open D:\Video\Squash Videos\3-9-21 for reading
libdvdread: Device D:\Video\Squash Videos\3-9-21 inaccessible, CSS authentication not available.
libdvdread: DVDOpenFilePath:findDVDFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[17:27:21] dvd: not a dvd - trying as a stream/file instead
[17:27:21] batch: scanning D:\Video\Squash Videos\3-9-21\GH010001_1.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Video\Squash Videos\3-9-21\GH010001_1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2022-11-30T07:24:27.000000Z
  Duration: 00:17:40.57, start: 0.000000, bitrate: 5316 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4994 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2022-11-30T07:24:27.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 317 kb/s (default)
    Metadata:
      creation_time   : 2022-11-30T07:24:27.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
      vendor_id       : [0][0][0][0]
[17:27:21] batch: scanning D:\Video\Squash Videos\3-9-21\GH010002_1.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Video\Squash Videos\3-9-21\GH010002_1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2022-11-30T08:19:28.000000Z
  Duration: 00:17:40.57, start: 0.000000, bitrate: 5316 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4994 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2022-11-30T08:19:28.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 317 kb/s (default)
    Metadata:
      creation_time   : 2022-11-30T08:19:28.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
      vendor_id       : [0][0][0][0]
[17:27:21] batch: scanning D:\Video\Squash Videos\3-9-21\GH020001_1.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Video\Squash Videos\3-9-21\GH020001_1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2022-11-30T08:34:52.000000Z
  Duration: 00:04:49.20, start: 0.000000, bitrate: 5315 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4994 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2022-11-30T08:34:52.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 317 kb/s (default)
    Metadata:
      creation_time   : 2022-11-30T08:34:52.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
      vendor_id       : [0][0][0][0]
[17:27:21] batch: scanning D:\Video\Squash Videos\3-9-21\GH020002_1.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Video\Squash Videos\3-9-21\GH020002_1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2022-11-30T08:44:34.000000Z
  Duration: 00:03:02.00, start: 0.000000, bitrate: 5315 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4994 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2022-11-30T08:44:34.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 317 kb/s (default)
    Metadata:
      creation_time   : 2022-11-30T08:44:34.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
      vendor_id       : [0][0][0][0]
[17:27:21] scan: decoding previews for title 1 (D:\Video\Squash Videos\3-9-21\GH010001_1.mp4)
[17:27:21] scan: audio 0x1: aac, rate=44100Hz, bitrate=317589 English (AAC LC) (2.0 ch) (317 kbps)
[17:27:22] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/240/240, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: left
[17:27:22] scan: decoding previews for title 2 (D:\Video\Squash Videos\3-9-21\GH010002_1.mp4)
[17:27:22] scan: audio 0x1: aac, rate=44100Hz, bitrate=317589 English (AAC LC) (2.0 ch) (317 kbps)
[17:27:23] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/240/240, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: left
[17:27:23] scan: decoding previews for title 3 (D:\Video\Squash Videos\3-9-21\GH020001_1.mp4)
[17:27:23] scan: audio 0x1: aac, rate=44100Hz, bitrate=317589 English (AAC LC) (2.0 ch) (317 kbps)
[17:27:23] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/240/240, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: left
[17:27:23] scan: decoding previews for title 4 (D:\Video\Squash Videos\3-9-21\GH020002_1.mp4)
[17:27:23] scan: audio 0x1: aac, rate=44100Hz, bitrate=317589 English (AAC LC) (2.0 ch) (317 kbps)
[17:27:24] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/240/240, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: left
[17:27:24] libhb: scan thread found 4 valid title(s)

 # Scan Finished ...


mduell
Veteran User
Posts: 8197
Joined: Sat Apr 21, 2007 8:54 pm

Re: Batch Trim videos using Range Seconds

Post by mduell »

GUI won't do it, use a batch script to run the CLI.
tdepke
Posts: 5
Joined: Tue Jan 03, 2023 10:23 pm

Re: Batch Trim videos using Range Seconds

Post by tdepke »

I'm new to HandBrake Command Line stuff so take it easy on me. I have an .mp4 file that was created from my Samsung smartphone in a folder called Input and I want the trimmed file to go into a folder named Output. I only put one in there right now because I want to make sure I get things right with one file before doing it with a bunch. Here is the command that I tried and the error log that I got. Not sure what this means or where to go from here.

.\HandBrakeCLI -Z. --preset "Fast 720p30" -i "D:\Test\Input" -o "D:\Test\Output" --start-at seconds:05 --stop-at seconds:07

Code: Select all

PS D:\WDownloads\Installation Files\HandBrakeCLI-1.6.0-win-x86_64> .\HandBrakeCLI -Z. --preset "Fast 720p30" -i "D:\Test\Input" -o "D:\Test\Output" --start-at seconds:05 --stop-at seconds:07
>>
[12:29:54] Compile-time hardening features are enabled
[12:29:54] qsv: not available on this system
[12:29:54] vcn: not available on this system
[12:29:54] nvenc: version 9.0 is available
[12:29:54] nvdec: is not compiled into this build
[12:29:54] hb_init: starting libhb thread
[12:29:54] thread 1 started ("libhb")
HandBrake 1.6.0 (2022122800) - MinGW x86_64 - https://handbrake.fr
8 CPUs detected
Opening D:\Test\Input...
[12:29:54] CPU: Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
[12:29:54]  - Intel microarchitecture Ivy Bridge
[12:29:54]  - logical processor count: 8
[12:29:54] Intel Quick Sync Video support: no
[12:29:54] hb_scan: path=D:\Test\Input, title_index=1
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
[12:29:54] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdread: Could not open input:
libdvdread: Can't open D:\Test\Input for reading
libdvdread: Device D:\Test\Input inaccessible, CSS authentication not available.
libdvdread: DVDOpenFilePath:findDVDFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[12:29:54] dvd: not a dvd - trying as a stream/file instead
[12:29:54] batch: scanning D:\Test\Input\20190118_165338.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Test\Input\20190118_165338.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2019-01-18T16:54:21.000000Z
    com.android.version: 8.0.0
  Duration: 00:00:41.92, start: 0.000000, bitrate: 12274 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720, 12014 kb/s, SAR 1:1 DAR 16:9, 30.03 fps, 30 tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2019-01-18T16:54:21.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      creation_time   : 2019-01-18T16:54:21.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]
Scanning title 1 of 1, 0.00 %[12:29:55] scan: decoding previews for title 1 (D:\Test\Input\20190118_165338.mp4)
[12:29:55] scan: audio 0x1: aac, rate=48000Hz, bitrate=256038 English (AAC LC) (2.0 ch) (256 kbps)
Scanning title 1 of 1, preview 3, 30.00 %[12:29:55] scan: 10 previews, 1280x720, 30.036 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: unspecified
Scanning title 1 of 1, preview 10, 100.00 %[12:29:55] libhb: scan thread found 1 valid title(s)
+ Using preset: Fast 720p30
+ title 1:
  + stream: D:\Test\Input\20190118_165338.mp4
  + duration: 00:00:41
  + size: 1280x720, pixel aspect: 1/1, display aspect: 1.78, 30.036 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: duration 00:00:41
  + audio tracks:
    + 1, English (AAC LC) (2.0 ch) (256 kbps) (iso639-2: eng)
  + subtitle tracks:
[12:29:55] Starting work at: Wed Jan 04 12:29:55 2023

[12:29:55] 1 job(s) to process
[12:29:55] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 160,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "av_aac",
                "Gain": 0.0,
                "Mixdown": "stereo",
                "NormalizeMixLevel": false,
                "PresetEncoder": "av_aac",
                "Quality": -3.0,
                "Samplerate": 0,
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac"
        ],
        "FallbackEncoder": "av_aac"
    },
 E n c"oDdeisntgi:n attaisokn "-:1  {o
f   - 1 ,   0 . 0"0A l%ignAVStart": true,
        "ChapterList": [
            {
                "Duration": {
                    "Hours": 0,
                    "Minutes": 0,
                    "Seconds": 41,
                    "Ticks": 3772800
                },
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "D:\\Test\\Output",
        "InlineParameterSets": false,
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": false
        },
        "Mux": "m4v"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 3,
                "Settings": {
                    "block-height": "16",
 E n c o d i n g :   t a s k" b-l1o cokf- t-h1r,e s0h."0:0  "%40",
                    "block-width": "16",
                    "filter-mode": "2",
                    "mode": "3",
                    "motion-thresh": "1",
                    "spatial-metric": "2",
                    "spatial-thresh": "1"
                }
            },
            {
                "ID": 4,
                "Settings": {
                    "mode": "7"
                }
            },
            {
                "ID": 7,
                "Settings": {
                    "mode": 2,
                    "rate": "27000000/900000"
                }
            },
            {
                "ID": 14,
                "Settings": {
-Ebnoctotdoimn"g::  0t,ap
s k   - 1   o f   - 1 ,   0 . 0 0   %  "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 0,
                    "height": 720,
                    "width": 1280
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 1,
        "Num": 1
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "D:\\Test\\Input\\20190118_165338.mp4",
        "Range": {
            "End": 1080000,
            "Start": 450000,
            "Type": "time"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
:E n[c]o"SubtitleList"
d i n g :} ,t
a s k   -"1V iodfe o-"1:,  {0
. 0 0   %    "ChromaLocation": 0,
        "ColorInputFormat": 0,
        "ColorMatrix": 1,
        "ColorOutputFormat": 0,
        "ColorPrimaries": 1,
        "ColorRange": 1,
        "ColorTransfer": 1,
        "Encoder": "x264",
        "HardwareDecode": 0,
        "Level": "3.1",
        "Options": "",
        "Preset": "fast",
        "Profile": "main",
        "QSV": {
            "AdapterIndex": 0,
            "AsyncDepth": 0,
            "Decode": false
        },
        "Quality": 21.0,
        "Tune": "",
        "Turbo": false,
        "TwoPass": false
    }
}
[12:29:56] CPU: Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
[12:29:56]  - Intel microarchitecture Ivy Bridge
[12:29:56]  - logical processor count: 8
iEdnecoo dsiunpgp:o rtta:s kn o0
 [o1f2 :02,9 :05.60]0  h%b_scan: path=D:\Test\Input\20190118_165338.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:333: failed opening UDF image D:\Test\Input\20190118_165338.mp4
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
[12:29:56] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdread: DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[12:29:57] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Test\Input\20190118_165338.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2019-01-18T16:54:21.000000Z
    com.android.version: 8.0.0
  Duration: 00:00:41.92, start: 0.000000, bitrate: 12274 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720, 12014 kb/s, SAR 1:1 DAR 16:9, 30.03 fps, 30 tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2019-01-18T16:54:21.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      creation_time   : 2019-01-18T16:54:21.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]
[12:29:57] scan: decoding previews for title 1
Scanning title 1 of 1, preview 1, 0.00 %[12:29:57] scan: audio 0x1: aac, rate=48000Hz, bitrate=256038 English (AAC LC) (2.0 ch) (256 kbps)
Scanning title 1 of 1, preview 5, 50.00 %[12:29:57] scan: 10 previews, 1280x720, 30.036 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: unspecified
[12:29:57] libhb: scan thread found 1 valid title(s)
[12:29:57] Starting Task: Encoding Pass
[12:29:57] Skipping crop/scale filter
[12:29:57] job configuration:
[12:29:57]  * source
[12:29:57]    + D:\Test\Input\20190118_165338.mp4
[12:29:57]    + title 1, start 00:00:5.00 stop 00:00:12.00
[12:29:57]    + container: mov,mp4,m4a,3gp,3g2,mj2
[12:29:57]    + data rate: 12274 kbps
[12:29:57]  * destination
[12:29:57]    + D:\Test\Output
[12:29:57]    + container: MPEG-4 (libavformat)
[12:29:57]      + align initial A/V stream timestamps
[12:29:57]  * video track
[12:29:57]    + decoder: h264 8-bit (yuv420p)
[12:29:57]      + bitrate 12014 kbps
[12:29:57]    + filters
[12:29:57]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[12:29:57]      + Decomb (mode=39)
[12:29:57]      + Framerate Shaper (mode=2:rate=27000000/900000)
[12:29:57]        + frame rate: 30.036 fps -> peak rate limited to 30.000 fps
[12:29:57]    + Output geometry
[12:29:57]      + storage dimensions: 1280 x 720
[12:29:57]      + pixel aspect ratio: 1 : 1
[12:29:57]      + display dimensions: 1280 x 720
[12:29:57]    + encoder: H.264 (libx264)
[12:29:57]      + preset:  fast
[12:29:57]      + profile: main
[12:29:57]      + level:   3.1
[12:29:57]      + quality: 21.00 (RF)
[12:29:57]      + color profile: 1-1-1
[12:29:57]      + chroma location: unspecified
[12:29:57]  * audio track 1
 Eindc o0dxi1n)gdecoder: English (AAC LC) (2.0 ch) (256 kbps) (track 1,
: [t1a2s:k2 91: 5o7f]  1 ,   0 . 0+0  b%itrate: 256 kbps, samplerate: 48000 Hz
[12:29:57]    + mixdown: Stereo
[12:29:57]    + encoder: AAC (libavcodec)
[12:29:57]      + bitrate: 160 kbps, samplerate: 48000 Hz
[12:29:57] sync: expecting 240 video frames
[12:29:57] encx264: min-keyint: 30, keyint: 300
[12:29:57] encx264: encoding at constant RF 21.000000
[12:29:57] encx264: unparsed options: level=3.1:ref=2:8x8dct=0:weightp=1:subme=6:vbv-bufsize=14000:vbv-maxrate=14000:rc-lookahead=30
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX UnalignedStack
x264 [info]: profile Main, level 3.1, 4:2:0, 8-bit
ERROR: avio_open2 failed, errno -13
[12:29:57] work: average encoding speed for job is 0.000000 fps
Encoding: task 1 of 1, 0.00 %[12:29:58] comb detect: heavy 0 | light 0 | uncombed 0 | total 0
[12:29:58] vfr: 0 frames output, 0 dropped and 0 duped for CFR/PFR
[12:29:58] vfr: lost time: 0 (0 frames)
[12:29:58] vfr: gained time: 0 (0 frames) (0 not accounted for)
E[n1c2o:d2i9n:g5:8 ]t aasakc -1d eocfo d1e,r  0d.o0n0e :% 0 frames, 0 decoder errors
[12:29:58] h264-decoder done: 0 frames, 0 decoder errors
[12:29:58] sync: got 0 frames, 240 expected
[12:29:58] mux: track 0, 0 frames, 0 bytes, 0.00 kbps, fifo 8
[12:29:58] mux: track 1, 0 frames, 0 bytes, 0.00 kbps, fifo 8
[12:29:58] Finished work at: Wed Jan 04 12:29:58 2023

[12:29:58] libhb: work result = 3

Encode failed (error 3).

HandBrake has exited.
tdepke
Posts: 5
Joined: Tue Jan 03, 2023 10:23 pm

Re: Batch Trim videos using Range Seconds

Post by tdepke »

OK, I got the file to encode using this command:

.\HandBrakeCLI -Z. --preset "Fast 720p30" -i "D:\Test\Input\20190118_165338.mp4" -o "D:\Test\Output\20190118_165338_5-7s.mp4" --start-at seconds:05 --stop-at seconds:02

However, I'm still not sure how to do this for a whole folder of files then. Ideally I'd name the new trimmed files by adding "_2s" to the end of the file name.
mduell
Veteran User
Posts: 8197
Joined: Sat Apr 21, 2007 8:54 pm

Re: Batch Trim videos using Range Seconds

Post by mduell »

Write a batch script to loop through each file in the folder, or use something like tdarr (formerly HBBatchBeast) to automate it.
tdepke
Posts: 5
Joined: Tue Jan 03, 2023 10:23 pm

Re: Batch Trim videos using Range Seconds

Post by tdepke »

OK so I figured it out but it took a little workaround. I downloaded HBBatchBeast for Windows here: https://github.com/HaveAGitGat/HBBatchB ... /tag/2.1.5

In opening the HBBatchBeast GUI, I put in this at the custom preset box: "--preset "Fast 720p30" --start-at seconds:02 --stop-at seconds:03"
HBBatchBeast then runs the following:

[15:24:30]Worker 1:Sending command to sub-worker:"C:\Program Files\hbbatchbeast-Windows-v2.1.5\HandBrakeCLI.exe" -i "D:\Test\Input\20190118_165338.mp4" -o "D:\Test\Output\20190118_165338_2s.mp4" --preset "Fast 720p30" --start-at seconds:02 --stop-at seconds:03

However, the file it puts out is the entire length of the original file and it seems to ignore the start at and stop at commands. When I paste this exact same command into my windows power shell, it outputs the file I'm looking for at only 3 seconds.

PS D:\WDownloads\Installation Files\HandBrakeCLI-1.6.0-win-x86_64> .\HandBrakeCLI -Z. -i "D:\Test\Input\20190118_165338.mp4" -o "D:\Test\Output\20190118_165338_2s.mp4" --preset "Fast 720p30" --start-at seconds:02 --stop-at seconds:03

Since I noticed that HBBatchBeast was older and was running an older version of HandBrakeCLI, I just replaced the newer HandBrakeCLI exe file into the HBBatchBeast folder and then reran the job again in HBBatchBeast and, VOILA!
tdepke
Posts: 5
Joined: Tue Jan 03, 2023 10:23 pm

Re: Batch Trim videos using Range Seconds

Post by tdepke »

I forgot to mention that these were very helpful and could help someone looking to do the same but with different parameters.

https://github.com/HaveAGitGat/HBBatchB ... tom-preset
https://handbrake.fr/docs/en/latest/cli ... rence.html
https://handbrake.fr/docs/en/latest/cli ... tions.html
Post Reply