Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a set of videos in the folder. I would like to get the info about this videos using ffmpeg -i command and save the output to file.

So I wrote the line:

find . -type f -exec ffmpeg -i {} \; > log.txt

But surprisingly, the log is empty! What am I missing here?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

I think what might be happening here is that ffmpeg is sending its output to stderr, in which case what you want is just:

find . -type f -exec ffmpeg -i {} \; 2>log.txt

I don't have ffmpeg in my distro to test with, but this has been verified with avconv from libav (should still be the same in this respect).

share|improve this answer

set the output inside the exec

find . -type f -exec ffmpeg -i {} \; > log.txt

breno@stormtrooper:/tmp$ find . -type f -exec ls {} >> /tmp/test.log \;
find: `./pulse-PKdhtXMmr18n`: Permission denied
breno@stormtrooper:/tmp$ ls
hsperfdata_breno  pulse-PKdhtXMmr18n  ssh-SLDpHf9PBb5g  t2  test.log
breno@stormtrooper:/tmp$ cat test.log 
./.X0-lock
./.t2.swp
./hsperfdata_breno/3692
./test.log
./.wine-1000/server-801-8a0557/lock
./t2
share|improve this answer
    
find . -type f -exec ls {} >> /tmp/test.log \; is exactly the same as find . -type f -exec ls {} \; >> /tmp/test.log. It's a simple command, the redirection can be anywhere on the line. –  Gilles Jan 29 at 23:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.