You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
6.4KB

  1. *************** FFMPEG soft VCR documentation *****************
  2. 0) Introduction
  3. ---------------
  4. FFmpeg is a very fast video and audio encoder. It can grab from
  5. files or from a live audio/video source.
  6. The command line interface is designed to be intuitive, in the sense
  7. that ffmpeg tries to figure out all the paramters, when
  8. possible. You have usually to give only the target bitrate you want.
  9. FFmpeg can also convert from any sample rate to any other, and
  10. resize video on the fly with a high quality polyphase filter.
  11. 1) Video and Audio grabbing
  12. ---------------------------
  13. * ffmpeg can use a video4linux compatible video source and any Open
  14. Sound System audio source:
  15. ffmpeg /tmp/out.mpg
  16. Note that you must activate the right video source and channel
  17. before launching ffmpeg. You can use any TV viewer such as xawtv by
  18. Gerd Knorr which I find very good. You must also set correctly the
  19. audio recording levels with a standard mixer.
  20. 2) Video and Audio file format convertion
  21. -----------------------------------------
  22. * ffmpeg can use any supported file format and protocol as input :
  23. examples:
  24. ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
  25. If will use the files:
  26. /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
  27. /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
  28. The Y files use twice the resolution of the U and V files. They are
  29. raw files, without header. They can be generated by all decent video
  30. decoders. You must specify the size of the image with the '-s' option
  31. if ffmpeg cannot guess it.
  32. * You can set several input files and output files:
  33. ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
  34. Convert the audio file a.wav and the raw yuv video file a.yuv to mpeg file a.mpg
  35. * you can also do audio and video convertions at the same time:
  36. ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
  37. Convert the sample rate of a.wav to 22050 Hz and encode it to MPEG audio.
  38. * you can encode to several formats at the same time and define a
  39. mapping from input stream to output streams:
  40. ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0
  41. convert a.wav to a.mp2 at 64 kbits and b.mp2 at 128 kbits. '-map
  42. file:index' specify which input stream is used for each output
  43. stream, in the order of the definition of output streams.
  44. NOTE: to see the supported input formats, use 'ffmpeg -formats'.
  45. 2) Invocation
  46. -------------
  47. * The generic syntax is :
  48. ffmpeg [[options][-i input_file]]... {[options] output_file}...
  49. If no input file is given, audio/video grabbing is done.
  50. As a general rule, options are applied to the next specified
  51. file. For example, if you give the '-b 64' option, it sets the video
  52. bitrate of the next file. Format option may be needed for raw input
  53. files.
  54. By default, ffmpeg tries to convert as losslessly as possible: it
  55. uses the same audio and video parameter fors the outputs as the one
  56. specified for the inputs.
  57. * Main options are:
  58. -h show help
  59. -formats show available formats, codecs and protocols
  60. -L print the LICENSE
  61. -i filename input file name
  62. -y overwrite output files
  63. -t duration set recording time in seconds
  64. -f format set encoding format [guessed]
  65. -title string set the title
  66. -author string set the author
  67. -copyright string set the copyright
  68. -comment string set the comment
  69. * Video Options are:
  70. -s size set frame size [160x128]
  71. -r fps set frame rate [25]
  72. -b bitrate set the video bitrate in kbit/s [200]
  73. -vn disable video recording [no]
  74. * Audio Options are:
  75. -ar freq set the audio sampling freq [44100]
  76. -ab bitrate set the audio bitrate in kbit/s [64]
  77. -ac channels set the number of audio channels [1]
  78. -an disable audio recording [no]
  79. Advanced options are:
  80. -map file:stream set input stream mapping
  81. -g gop_size set the group of picture size [12]
  82. -intra use only intra frames [no]
  83. -qscale q use fixed video quantiser scale (VBR)
  84. -c comment set the comment string
  85. -vd device set video4linux device name [/dev/video]
  86. -vcodec codec force audio codec
  87. -me method set motion estimation method
  88. -ad device set audio device name [/dev/dsp]
  89. -acodec codec force audio codec
  90. The output file can be "-" to output to a pipe. This is only possible
  91. with mpeg1 and h263 formats.
  92. 3) Protocols
  93. ffmpeg handles also many protocols specified with the URL syntax.
  94. Use 'ffmpeg -formats' to have a list of the supported protocols.
  95. The protocol 'http:' is currently used only to communicate with
  96. ffserver (see the ffserver documentation). When ffmpeg will be a
  97. video player it will also be used for streaming :-)
  98. 4) File formats and codecs
  99. --------------------------
  100. Use 'ffmpeg -formats' to have a list of the supported output
  101. formats. Only some formats are handled as input, but it will improve
  102. in the next versions.
  103. 5) Tips
  104. -------
  105. - For streaming at very low bit rate application, use a low frame rate
  106. and a small gop size. This is especially true for real video where
  107. the Linux player does not seem to be very fast, so it can miss
  108. frames. An example is:
  109. ffmpeg -g 3 -r 3 -t 10 -b 50 -s qcif -f rv10 /tmp/b.rm
  110. - The parameter 'q' which is displayed while encoding is the current
  111. quantizer. The value of 1 indicates that a very good quality could
  112. be achieved. The value of 31 indicates the worst quality. If q=31
  113. too often, it means that the encoder cannot compress enough to meet
  114. your bit rate. You must either increase the bit rate, decrease the
  115. frame rate or decrease the frame size.
  116. - If your computer is not fast enough, you can speed up the
  117. compression at the expense of the compression ratio. You can use
  118. '-me zero' to speed up motion estimation, and '-intra' to disable
  119. completly motion estimation (you have only I frames, which means it
  120. is about as good as JPEG compression).
  121. - To have very low bitrates in audio, reduce the sampling frequency
  122. (down to 22050 kHz for mpeg audio, 22050 or 11025 for ac3).
  123. - To have a constant quality (but a variable bitrate), use the option
  124. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  125. quality).
  126. - When converting video files, you can use the '-sameq' option which
  127. uses in the encoder the same quality factor than in the decoder. It
  128. allows to be almost lossless in encoding.