Trouble copying audio file – until rdd-copy

I had trouble copying a audio file (wav) from a CD to my computer – the copy process was always getting stuck at exactly the same point 153MB in. And it didn’t matter whether I was using sound-juicer or nautilus. The answer was to install rdd (sudo apt-get install rdd). rdd copes with errors by supplying blanks (assuming multiple careful attempts to read the data have all failed) rather than halting.

The required command was rdd-copy src dest. But what to supply as src? I tried /media and similar but no luck. The final answer was ‘/run/user/1000/gvfs/cdda:host=sr0/Track 3.wav’. But how to find it? Just drag the file from nautilus to the terminal and see what is displayed there. The following worked even though it took a long time to get the file:

rdd-copy '/run/user/1000/gvfs/cdda:host=sr0/Track 3.wav' /home/g/Desktop/track3.wav

Rotate video (and cope with frame rate problem)

The problem – I had taken a video on a smart phone upside down and needed to rotate it (Note – rotating is not the same as flipping). Here is the successful command I used on Ubuntu:

avconv -i "my_input_video.mp4" -r 25 -vf transpose=1,transpose=1 my_output_video.mp4

Note – I needed to rotate it so chaining two 90 degree transpose commands (transpose=1 is a single 90 degree transposition) worked (see How can I rotate video by 180 degrees with avconv).

Note the -r 25. I don’t pretend to understand all the options of ffmpeg/avconv but the -r 25 forced the conversion to use a manageable number of frames. Without it, converting one particular video was failing, thrashing the CPU, and taking forever. There was a message in the ffmpeg/avconv output about MB rate > level limit. Another video worked fine without -r 25 but if you have the same problem with MB rate give -r 25 a try. Or better yet, learn more about what you’re doing ;-). I didn’t have the time or inclination so tried to do the least I could to get a good result.

Update – needed to alter aspect ratio as per:

avconv -i "my_image.MOD" -aspect 0.487 -r 25 -vf transpose=1,transpose=1,transpose=1 -strict -2 "my_image.mp4"

Quick MPG4 to AVI conversion

The problem – my wife had an mpg4 but it wouldn’t play on the machine upstair. Needed an AVI instead. I couldn’t be bothered learning all the various settings of ffmpeg (libav is a fork) but found an acceptable (albeit inefficient) way of getting the same quality in the AVI as in the MPG4. OK, the file size was 3-4x larger, so I would recommend optimising things if doing multiple conversions, but this is a good and simple answer for the occasional one-off.

ffmpeg -i original.mp4 -sameq converted_version.avi