Convert a zillion .rm files to .mp4
May 27, 2015 10:11 AM Subscribe
The organization for which I work has one zillion (well, OK, maybe 40,000) videos in the Real media format. I did not create this scenario, I am only dealing with it. The videos reside on a single server, and are in multiple nested directories. I want/need to convert them to a more neutral format (I'm thinking mp4), using as little manual intervention as possible .
Ideally there's a program that I can fire up, point at the root directory and it will just chug its way (for six weeks!) through converting every .rm it finds. Eventually every file (\\server\folder\folder\folder\video.rm) will have a copy called (\\server\folder\folder\folder\video.mp4)
I'm ok paying for a tool, and I'm ok with a command line tool, if that is the only way to get it done. I have tried Handbrake but so far have not been able to get it to work for this.
Ideally there's a program that I can fire up, point at the root directory and it will just chug its way (for six weeks!) through converting every .rm it finds. Eventually every file (\\server\folder\folder\folder\video.rm) will have a copy called (\\server\folder\folder\folder\video.mp4)
I'm ok paying for a tool, and I'm ok with a command line tool, if that is the only way to get it done. I have tried Handbrake but so far have not been able to get it to work for this.
Best answer: Do you have access to a Linux box? This example shows conversion of foo.rm to foo.mp4:
It would not be difficult to recurse through a directory tree and run that command across every .rm file that is present. You'd want to test it out on a small sample first before turning it loose on the entire archive.
ffmpeg seems to be available for Windows - you'd have to consult someone better versed than I in Windows CLI scripting for the recursion bit. Looks to be available as a binary package for OSX as well.
posted by jquinby at 10:29 AM on May 27, 2015 [4 favorites]
ffmpeg -i foo.rm -vcodec mpeg4 -sameq -acodec libfaac -ab 94208 foo.mp4
It would not be difficult to recurse through a directory tree and run that command across every .rm file that is present. You'd want to test it out on a small sample first before turning it loose on the entire archive.
ffmpeg seems to be available for Windows - you'd have to consult someone better versed than I in Windows CLI scripting for the recursion bit. Looks to be available as a binary package for OSX as well.
posted by jquinby at 10:29 AM on May 27, 2015 [4 favorites]
(that ffmpeg example was hustled from this ArchLinux page)
posted by jquinby at 10:34 AM on May 27, 2015 [1 favorite]
posted by jquinby at 10:34 AM on May 27, 2015 [1 favorite]
Best answer: Here's your crude (oh, so, so crude) command line work to do the job, laid out in multiple steps so that you can see what's going on. As usual, all of this could be replaced by a single dense line of perl, but anyway:
$ find . -name "*.rm" -print > todo.txt
$ awk '{print "name_of_the_tool --with-options -i", $1, "-o", $1"xx"}' todo.txt > dummy.txt
# So appending xx to the name of the input file to get the output file name
$ cat dummy.txt | sed 's/rmxx/mp4/g' > dothis.txt
# Now fix the output filename. Hopefully no files had "rmxx" in their names!
$ sh < dothis.txt
# Yikes! All in one go? Break it up into lots of a few hundred, at least.
$ rm dummy.txt todo.txt
Obviously, you could replace the temp files with pipes instead, etc. And name_of_the_tool is probably something like ffmpeg?
What's more concerning is that a script like this has no checkpointing and no error checking. For 40,000 files, I'd probably put in some error handling and validation every 400 files or so - that's a few more lines of code in your favorite scripting language.
posted by RedOrGreen at 10:36 AM on May 27, 2015 [1 favorite]
$ find . -name "*.rm" -print > todo.txt
$ awk '{print "name_of_the_tool --with-options -i", $1, "-o", $1"xx"}' todo.txt > dummy.txt
# So appending xx to the name of the input file to get the output file name
$ cat dummy.txt | sed 's/rmxx/mp4/g' > dothis.txt
# Now fix the output filename. Hopefully no files had "rmxx" in their names!
$ sh < dothis.txt
# Yikes! All in one go? Break it up into lots of a few hundred, at least.
$ rm dummy.txt todo.txt
Obviously, you could replace the temp files with pipes instead, etc. And name_of_the_tool is probably something like ffmpeg?
What's more concerning is that a script like this has no checkpointing and no error checking. For 40,000 files, I'd probably put in some error handling and validation every 400 files or so - that's a few more lines of code in your favorite scripting language.
posted by RedOrGreen at 10:36 AM on May 27, 2015 [1 favorite]
Best answer: tree /F /A in windows would give you a map of all the folders and files. You could pipe (> filename.txt) that into a text file (or excel), and modify it to make a mother of all batch files to run ffmpeg in a windows environment. I would suggest breaking it up into batches of 50-100 to run each night, and let it work it's way through them.
posted by nickggully at 10:42 AM on May 27, 2015
posted by nickggully at 10:42 AM on May 27, 2015
I just googled "batch converter rm mp4" and this program showed up: http://www.rmconverter.com/ This looks like another one maybe: http://www.boilsoft.com/rmconverter/rm-to-mp4-converter.html
posted by AppleTurnover at 11:03 AM on May 27, 2015
posted by AppleTurnover at 11:03 AM on May 27, 2015
If you can get one of the RM codecs to work there are a lot of converters that can do so in batch mode.
I used to like FormatFactory until it turned into bundleware (installed a lot of crap alongside itself)
VLC has a converter built-in, but it'd kinda obtuse.
posted by kschang at 11:50 AM on May 27, 2015
I used to like FormatFactory until it turned into bundleware (installed a lot of crap alongside itself)
VLC has a converter built-in, but it'd kinda obtuse.
posted by kschang at 11:50 AM on May 27, 2015
Best answer: In windows CMD:
for /f %D in ('dir /b /s *.rm') do {converter program} %D
run from the root directory (or the highest level folder where everything is saved). Where the output files goes depends on the converter program you use; replace everything after "do" with "echo %D > allfiles.txt" to just get a list of all files including path. If you put it in a batch file, you have to double the % everywhere they occur.
posted by AzraelBrown at 11:56 AM on May 27, 2015
for /f %D in ('dir /b /s *.rm') do {converter program} %D
run from the root directory (or the highest level folder where everything is saved). Where the output files goes depends on the converter program you use; replace everything after "do" with "echo %D > allfiles.txt" to just get a list of all files including path. If you put it in a batch file, you have to double the % everywhere they occur.
posted by AzraelBrown at 11:56 AM on May 27, 2015
ffmpeg is definitely the way to go. It'd be almost trivial to do this with a bit of Bash scripting (eg. RedOrGreen's answer).
VLC has a converter built-in, but it'd kinda obtuse.
VLC uses ffmpeg internally. You'd get the same results from the command line.
posted by neckro23 at 12:18 PM on May 27, 2015 [1 favorite]
VLC has a converter built-in, but it'd kinda obtuse.
VLC uses ffmpeg internally. You'd get the same results from the command line.
posted by neckro23 at 12:18 PM on May 27, 2015 [1 favorite]
I know mencoder on Linux can read and convert rm files given the right codecs, though I can't offhand remember how well it handles multiple files. I think it's slower and higher-quality than ffmpeg.
posted by Pronoiac at 12:22 PM on May 27, 2015
posted by Pronoiac at 12:22 PM on May 27, 2015
Ffmeg is what everybody uses. Even YouTube uses it behind the scenes. You would get much better quality if you fed it the original uncompressed files rather than transcoding the Real files.
posted by w0mbat at 12:37 PM on May 27, 2015
posted by w0mbat at 12:37 PM on May 27, 2015
I occassionally use MediaCoder for that kind of batch work because it has a nice GUI and I can drop a bunch of files on it and it goes to town. Caveats: I never work with Real Media (though the Web site seems to say it can) and I'm not saying it's the best possible solution or that ffmpeg might not be better.
posted by forthright at 7:18 PM on May 27, 2015
posted by forthright at 7:18 PM on May 27, 2015
This thread is closed to new comments.
posted by Lazlo Hollyfeld at 10:24 AM on May 27, 2015