![]() |
stuck at bash script to convert files with ffmpeg
Hello,
I have a samba share in my network with folders and subfolders. Every day users must add new video files DV AVI and MPEG2. DV AVI is to large to keep for a long time and I looked for an easy script to convert only DV AVI files to MPEG2. I found two scripts each with one little problem: First one converts the avi from main folder only and not from whole directory tree: Code:
#!/bin/shCode:
#!/bin/shBig thanks!! |
Code:
#!/bin/sh |
You can use filename substitution;
file=a_movie.avi outfile=${file%.avi}.mpg I'd also recommend using better options for ffmpeg instead of sameq. It will use a larger bandwidth than necessary because it is trying to avoid any loss in quality using a lossy compression scheme. Determine the optimum format and options for your needs or device and stick with it. The input doesn't matter much. At work, I will convert commercials using ffmpeg. This is the command I use for fixed 7MB/sec interlaced commercial spots: Code:
ffmpeg -i <videoin> -f dvd -vcodec mpeg2video -pix_fmt yuv420p -vb 7000k -r 29.97 -minrate 7000k -maxrate 7000k -bufsize 800k -flags +ilme+ildct \For variable rate videos, look at the qmin and qmax values instead of minrate and maxrate. |
Quote:
|
I used -sameq in my post because it's not relevant at this point.
I was able to solve it somehow: Code:
#!/bin/shThe second line renames .avi.mpg to .mpg. The script is not yet ready for my needs but the problem is SOLVED :) Many thanks!! |
Or if you wanted you could have just put your first 2 scripts together (kinda):
Code:
#!/bin/bash |
man sed:
Code:
[schneidz@hyper clips]$ echo filename.mpg | sed s/mpg/avi/Code:
[schneidz@hyper clips]$ file hobo-with-a-gun.mpg |
| All times are GMT -5. The time now is 01:53 AM. |