Skip to content

Commit 0a47842

Browse files
committed
- [+] FFCVT_MAXC support added for -maxc
1 parent 2d48fde commit 0a47842

5 files changed

Lines changed: 35 additions & 0 deletions

File tree

config.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"flag"
99
"fmt"
1010
"os"
11+
"strconv"
1112
"time"
1213
)
1314

@@ -308,13 +309,25 @@ func initVals() {
308309
if _, exists = os.LookupEnv("FFCVT_NC"); Opts.NoClobber || exists {
309310
Opts.NoClobber = true
310311
}
312+
if Opts.MaxC == 0 ||
313+
len(os.Getenv("FFCVT_MAXC")) != 0 {
314+
if i, err := strconv.Atoi(os.Getenv("FFCVT_MAXC")); err == nil {
315+
Opts.MaxC = i
316+
}
317+
}
311318
if _, exists = os.LookupEnv("FFCVT_N"); Opts.NoExec || exists {
312319
Opts.NoExec = true
313320
}
314321

315322
if _, exists = os.LookupEnv("FFCVT_FORCE"); Opts.Force || exists {
316323
Opts.Force = true
317324
}
325+
if Opts.Debug == 0 ||
326+
len(os.Getenv("FFCVT_DEBUG")) != 0 {
327+
if i, err := strconv.Atoi(os.Getenv("FFCVT_DEBUG")); err == nil {
328+
Opts.Debug = i
329+
}
330+
}
318331
if len(Opts.FFMpeg) == 0 ||
319332
len(os.Getenv("FFCVT_FFMPEG")) != 0 {
320333
Opts.FFMpeg = os.Getenv("FFCVT_FFMPEG")

ffcvt.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ func main() {
115115
os.Exit(0)
116116
}
117117

118+
//fmt.Printf("%+v\n", Opts)
118119
if len(Opts.Seg) > 0 {
119120
// sanity check
120121
_, err := time.Parse("15:04:05", Opts.Seg)

test/ffcvt_test.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,16 @@ ffcvt: to execute -
426426
ffmpeg -i ./test1.avi -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./test1_.mkv
427427
Time taken so far xxx ms
428428
] Max conversion count reached.
429+
] None-video file './ffcvt_test.txt' duplicated to dest dir.
430+
] None-video file './test-all.sh' duplicated to dest dir.
431+
432+
== Transcoding [1/4] (100%): 'StreamSample.mkv'
433+
under .
434+
] ffmpeg -i ./StreamSample.mkv -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./StreamSample_.mkv
435+
ffcvt: to execute -
436+
ffmpeg -i ./StreamSample.mkv -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./StreamSample_.mkv
437+
Time taken so far xxx ms
438+
] Max conversion count reached.
429439
] Transcoding to /tmp/test
430440
] None-video file './ffcvt_test.txt' duplicated to dest dir.
431441
] None-video file './test-all.sh' duplicated to dest dir.

test/test-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ $FFCVT -t x265-opus -n -bt 0.1s -d . -sym >> /tmp/ffcvt_test.txt 2>&1
4040
$FFCVT -n -bt 0.1s -d . >> /tmp/ffcvt_test.txt 2>&1
4141
$FFCVT -n -bt 0.1s -d . -sym >> /tmp/ffcvt_test.txt 2>&1
4242
$FFCVT -n -bt 0.1s -d . -sym -maxc 2 >> /tmp/ffcvt_test.txt 2>&1
43+
FFCVT_MAXC=1 $FFCVT -n -bt 0.1s -d . -sym >> /tmp/ffcvt_test.txt 2>&1
4344

4445
$FFCVT -n -sym -debug 2 -bt 0.1s -d . -w /tmp >> /tmp/ffcvt_test.txt 2>&1
4546

test2/ffcvt_test.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,16 @@ ffcvt: to execute -
410410
ffmpeg -i ./test1.avi -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./test1_.mkv
411411
Time taken so far xxx ms
412412
] Max conversion count reached.
413+
] None-video file './ffcvt_test.txt' duplicated to dest dir.
414+
] None-video file './test-all.sh' duplicated to dest dir.
415+
416+
== Transcoding [1/4] (36%): 'test_s1.avi'
417+
under subdir
418+
] ffmpeg -i ./subdir/test_s1.avi -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./subdir/test_s1_.mkv
419+
ffcvt: to execute -
420+
ffmpeg -i ./subdir/test_s1.avi -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./subdir/test_s1_.mkv
421+
Time taken so far xxx ms
422+
] Max conversion count reached.
413423
] Transcoding to /tmp/test2
414424
] None-video file './ffcvt_test.txt' duplicated to dest dir.
415425
] None-video file './test-all.sh' duplicated to dest dir.

0 commit comments

Comments
 (0)