Thursday, 22 August 2013

Using xargs and sed to reprocess avi files

Using xargs and sed to reprocess avi files

I have a bunch of AVI's that I'd like to reprocess to h264 MKVs. The
command I'm trying to use is:
find . -name "*.avi" | xargs -I '{}' ffmpeg -i {} -vcodec libx264 `echo {}
| sed 's/avi/mkv/'`
However, it does not work as expected. Adding -t to xargs shows that the
command being run is (given a directory with file1.avi)
ffmpeg ./file1.avi -vcodec libx264 ./file1.avi
I'm not sure why the sed command isn't getting processed correctly. ffmpeg
fails because it does not overwrite by default.
The AVIs are all in sub-directories so I don't really want to do a for
loop for each subfolder and find / xargs would be a much better solution.
Also, I don't really want to rename everything after this is done.

No comments:

Post a Comment