Skip to content

Commit

Permalink
- [+] FFCVT_MAXC support added for -maxc
Browse files Browse the repository at this point in the history
  • Loading branch information
suntong committed May 27, 2023
1 parent 2d48fde commit 0a47842
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"flag"
"fmt"
"os"
"strconv"
"time"
)

Expand Down Expand Up @@ -308,13 +309,25 @@ func initVals() {
if _, exists = os.LookupEnv("FFCVT_NC"); Opts.NoClobber || exists {
Opts.NoClobber = true
}
if Opts.MaxC == 0 ||
len(os.Getenv("FFCVT_MAXC")) != 0 {
if i, err := strconv.Atoi(os.Getenv("FFCVT_MAXC")); err == nil {
Opts.MaxC = i
}
}
if _, exists = os.LookupEnv("FFCVT_N"); Opts.NoExec || exists {
Opts.NoExec = true
}

if _, exists = os.LookupEnv("FFCVT_FORCE"); Opts.Force || exists {
Opts.Force = true
}
if Opts.Debug == 0 ||
len(os.Getenv("FFCVT_DEBUG")) != 0 {
if i, err := strconv.Atoi(os.Getenv("FFCVT_DEBUG")); err == nil {
Opts.Debug = i
}
}
if len(Opts.FFMpeg) == 0 ||
len(os.Getenv("FFCVT_FFMPEG")) != 0 {
Opts.FFMpeg = os.Getenv("FFCVT_FFMPEG")
Expand Down
1 change: 1 addition & 0 deletions ffcvt.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func main() {
os.Exit(0)
}

//fmt.Printf("%+v\n", Opts)
if len(Opts.Seg) > 0 {
// sanity check
_, err := time.Parse("15:04:05", Opts.Seg)
Expand Down
10 changes: 10 additions & 0 deletions test/ffcvt_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,16 @@ ffcvt: to execute -
ffmpeg -i ./test1.avi -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./test1_.mkv
Time taken so far xxx ms
] Max conversion count reached.
] None-video file './ffcvt_test.txt' duplicated to dest dir.
] None-video file './test-all.sh' duplicated to dest dir.

== Transcoding [1/4] (100%): 'StreamSample.mkv'
under .
] ffmpeg -i ./StreamSample.mkv -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./StreamSample_.mkv
ffcvt: to execute -
ffmpeg -i ./StreamSample.mkv -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./StreamSample_.mkv
Time taken so far xxx ms
] Max conversion count reached.
] Transcoding to /tmp/test
] None-video file './ffcvt_test.txt' duplicated to dest dir.
] None-video file './test-all.sh' duplicated to dest dir.
Expand Down
1 change: 1 addition & 0 deletions test/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ $FFCVT -t x265-opus -n -bt 0.1s -d . -sym >> /tmp/ffcvt_test.txt 2>&1
$FFCVT -n -bt 0.1s -d . >> /tmp/ffcvt_test.txt 2>&1
$FFCVT -n -bt 0.1s -d . -sym >> /tmp/ffcvt_test.txt 2>&1
$FFCVT -n -bt 0.1s -d . -sym -maxc 2 >> /tmp/ffcvt_test.txt 2>&1
FFCVT_MAXC=1 $FFCVT -n -bt 0.1s -d . -sym >> /tmp/ffcvt_test.txt 2>&1

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

Expand Down
10 changes: 10 additions & 0 deletions test2/ffcvt_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,16 @@ ffcvt: to execute -
ffmpeg -i ./test1.avi -c:v libvpx-vp9 -b:v 0 -crf 42 -c:a libopus -b:a 64k -c:s copy ./test1_.mkv
Time taken so far xxx ms
] Max conversion count reached.
] None-video file './ffcvt_test.txt' duplicated to dest dir.
] None-video file './test-all.sh' duplicated to dest dir.

== Transcoding [1/4] (36%): 'test_s1.avi'
under subdir
] 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
ffcvt: to execute -
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
Time taken so far xxx ms
] Max conversion count reached.
] Transcoding to /tmp/test2
] None-video file './ffcvt_test.txt' duplicated to dest dir.
] None-video file './test-all.sh' duplicated to dest dir.
Expand Down

0 comments on commit 0a47842

Please sign in to comment.