같은 명령, 많은 파일
한 파일에 FFmpeg 명령 동작하면, folder 전체에 batch는 3줄 shell loop. 알아둘 패턴 셋.
- Bash for-loop — 읽기 좋음, 순차, interrupt 쉬움.
- find + -exec — 이상한 파일이름 robust, recursive, 파일당 명령 하나.
- GNU parallel — N 작업 동시. 각 encode 가 CPU-bound 일 때 dramatic 속도.
항상 파일이름 quote
파일이름의 space와 special character 가 깨진 batch script #1 source. $f bare 안 되고 항상 "$f" quote. 200 파일 가리키기 전에 space 든 파일 하나 있는 folder에 테스트.