Save find -exec output to text file

15,111

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:
15,111

Related videos on Youtube

Gilles 'SO- stop being evil'
Author by

Gilles 'SO- stop being evil'

Updated on September 18, 2022

Comments

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 2 years

    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?

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 10 years
    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.