2013-06-17 2 views
0

이 질문에 대해 유감스럽게 생각합니다. 그러나 대답은 매우 간단하지만 검색은 있었지만 답변을 찾지 못했습니다.bash while loop and ffmpeg

내가 작성한 다음 그 다음 코드를 작성해야 않는 경우 폴더가 지정된 JPEG가 포함되어있는 경우

while read p      # reads in each line of the text 
do         # file- folder_list.txt each iteration. 
    echo "$p"      # print out current line 
    if [ -f $p/frame_number1.jpg ] # checks if the image exists in the specific folder 
    then 
     echo "$p"     #prints specific folder name 
     sleep 1      #pause for 1 second 
     ffmpeg -f image2 -r 10 -i $p/frame_number%01d.jpg -r 30 $p/out.mp4 #create video 
    fi        # end if statement 
done <folder_list.txt    #end of while loop 
스크립트는 폴더 트리 구조를 포함하는 텍스트 파일을 읽을하도록되어

다음 확인 지정된 폴더에 포함 된 이미지의 비디오.

그러나 스크립트에서 이미지가 포함 된 전체 폴더는 건너 뜁니다. while 루프가 비디오가 생성되는 동안 계속 반복되는지 또는 다른 것이 발생하는지 궁금합니다.

도움을 주시면 감사하겠습니다. 사전

로렌스

+0

: 문제가 해결되지 않으면 명령

을 깨는 여러 인수로 분리, 정확히 확인되는 디렉토리와 확인되지 않은 것들 중 몇 가지를 알려 "주위에 var 결과적으로 – hek2mgl

+0

어느 것이 든 작동하는 덕분입니다. –

+0

모든 sudo 문제가 있습니까? 그것이 어떤 폴더를 건너 뛰고 다른 사람을 건너 뛰는 경우 ... sudo로 스크립트를 실행하려고하면 – Franko

답변

0

일부 폴더에 공백 또는 다른 이상한 문자가 포함되어 있기 때문에이 될 수있는

많은 감사합니다.

(대부분의 경우 모든하지만 작동하지 않습니다)이 시도 :

while read p   # reads in each line of the text file- folder_list.txt 
do      #each iteration 
    echo "$p"    #print out current line 
    if [ -f "${p}/frame_number1.jpg" ] #checks wether the image exists in the specific folder 
    then echo "$p"  #printsout specific folder name 
     sleep 1     #pause for 1 second 
     ffmpeg -f image2 -r 10 -i "${p}/frame_number%01d.jpg" -r 30 "${p}/out.mp4" #create video 
    fi     # end if statement 
done <folder_list.txt #end of while loop 

나는 방금 추가 따옴표를 "$ 피"를 포함하는 인수 주위 공간 (다른 것들)이 포함되어있는 경우 즉, 그렇지 그래서 당신은`사용하여 누락

ls -ald /some/ok/dir  /some/NOTOK/dir #will show which directories belong to who 
id #will tell us which user you are using, so we can compare to the previous and find out why you can't access some