各种文件转换命令

Category: /knowledge /linux
Tags: linux

Audio/Video

copy with dvdbackup ——————————— A single title

dvdbackup -i /dev/dvd -o ~ -t 1

The main feature

dvdbackup -i /dev/dvd -o ~ -F

The whole DVD

dvdbackup -i /dev/dvd -o ~ -M

Creating an ISO

mkisofs -dvd-video -udf -o ~/dvd.iso ~/MOVIE_NAME

Test playing with mplayer

mplayer dvd:// -dvd-device ~/dvd.iso

burn the image

growisofs -Z /dev/dvd=~/dvd.iso

copy DVD images

sudo apt-get install libdvdread4
sudo /usr/share/doc/libdvdread4/install-css.sh
then try k9copy

convert from VOB to AVI

ffmpeg -b 1600k -vcodec [libxvid|mpeg4|copy] -i VTS_01_1.VOB ~/download/output.avi

这里的1600k是bits/second, 不是kbytes/sec, 所以不能设太低. 我一般取原文件的1/4.

split/extract videos

如果我想截取一个视频文件中的一小部分, 如果从第4分33秒处开始, 截取15分钟长的视频. 在编辑视频时很有用.

ffmpeg -vcodec copy -ss 00:04:33 -t 00:15:00 -i infile.avi outfile.avi

如果想截图的话用

每一秒截一张, size: WxH
ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg

-vframes -t -ss 结合起来可指定时间/长度/张数

convert from APE to WAV

ffmpeg -i input.ape ~/download/output.wav

convert from WAV to MP3

ffmpeg -i input.wav -vn -ar 44100 -ac 2 -ab 192k -f mp3 output.mp3

Extracting sound from a video, and save it as Mp3

ffmpeg -i source_video.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 sound.mp3

adjust MP3 bitrate

Suppose I need to convert current mp3 audio books to a lower bitrate at 112K to a folder called “new_dir”, run

for fn in `ls *.mp3`; do ffmpeg -i $fn -ab 112k new_dir/$fn; done

PDF and other doc types

trim/crop edges of PDF files

sudo aptitude install pdfjam

pdfnup --nup 1x1 --trim "1cm 3cm 1cm 1cm" --outfile test.pdf your_source.pdf 
# note: the order of trim parameters are "left bottom right top"

split/merge PDF files

sudo aptitude install pdftk

merge files into one PDF:

pdftk 001.pdf 002.pdf cat output one-large-single-file.pdf

split a large PDF to many single-page files: 这个可以用在把批处理扫描的文件打散分别处理. 

pdftk large-file.pdf burst

讨论

提示

  • 如果看不到讨论部分, 请暂时关掉adblock in Firefox/Chrome
  • 本网站使用Javascript实现评论功能, 此处外链对提高您的网站PR没有帮助. (潜台词: 请不要灌水, 谢谢)