Last active
August 29, 2015 14:10
-
-
Save aont/d5f22e23a67ba7bb6681 to your computer and use it in GitHub Desktop.
quasi streaming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| input="input" | |
| $log=File::open("log.txt", "w") | |
| def do_enc(input, start_at, stop_at, output) | |
| command = "HandBrakeCLI -Z \"Android Tablet\" -e x264 -q 25.0 --x264-preset medium -E faac -i \"%s\" --main-feature -a 1 --subtitle-burned 1 -O -m --start-at duration:%s --stop-at duration:%s --decomb bob -o %s" % [input, start_at, stop_at, output] | |
| $stderr.puts "----------------------------------" | |
| $stderr.puts command | |
| $stderr.puts "----------------------------------" | |
| $log.printf "%s %s %s\n", output, start_at, stop_at | |
| $log.flush | |
| flag=system(command) | |
| if !flag | |
| exit | |
| end | |
| end | |
| duration_all=6264 | |
| duration=10 | |
| start_at=0 | |
| num=0 | |
| while start_at <= duration_all | |
| output = "%08d.mp4" % num | |
| do_enc(input, start_at, duration+1, output) | |
| num += 1 | |
| start_at += duration | |
| duration = (duration*1.5).to_i | |
| end | |
| $log.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment