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.

970 lines
28KB

  1. \input texinfo @c -*- texinfo -*-
  2. @settitle FFmpeg Documentation
  3. @titlepage
  4. @sp 7
  5. @center @titlefont{FFmpeg Documentation}
  6. @sp 3
  7. @end titlepage
  8. @chapter Synopsis
  9. The generic syntax is:
  10. @example
  11. @c man begin SYNOPSIS
  12. ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
  13. @c man end
  14. @end example
  15. @chapter Description
  16. @c man begin DESCRIPTION
  17. FFmpeg is a very fast video and audio converter. It can also grab from
  18. a live audio/video source.
  19. The command line interface is designed to be intuitive, in the sense
  20. that FFmpeg tries to figure out all parameters that can possibly be
  21. derived automatically. You usually only have to specify the target
  22. bitrate you want.
  23. FFmpeg can also convert from any sample rate to any other, and resize
  24. video on the fly with a high quality polyphase filter.
  25. As a general rule, options are applied to the next specified
  26. file. Therefore, order is important, and you can have the same
  27. option on the command line multiple times. Each occurrence is
  28. then applied to the next input or output file.
  29. * To set the video bitrate of the output file to 64kbit/s:
  30. @example
  31. ffmpeg -i input.avi -b 64k output.avi
  32. @end example
  33. * To force the frame rate of the output file to 24 fps:
  34. @example
  35. ffmpeg -i input.avi -r 24 output.avi
  36. @end example
  37. * To force the frame rate of the input file (valid for raw formats only)
  38. to 1 fps and the frame rate of the output file to 24 fps:
  39. @example
  40. ffmpeg -r 1 -i input.m2v -r 24 output.avi
  41. @end example
  42. The format option may be needed for raw input files.
  43. By default, FFmpeg tries to convert as losslessly as possible: It
  44. uses the same audio and video parameters for the outputs as the one
  45. specified for the inputs.
  46. @c man end DESCRIPTION
  47. @chapter Options
  48. @c man begin OPTIONS
  49. @include fftools-common-opts.texi
  50. @section Main options
  51. @table @option
  52. @item -f @var{fmt}
  53. Force format.
  54. @item -i @var{filename}
  55. input file name
  56. @item -y
  57. Overwrite output files.
  58. @item -t @var{duration}
  59. Restrict the transcoded/captured video sequence
  60. to the duration specified in seconds.
  61. @code{hh:mm:ss[.xxx]} syntax is also supported.
  62. @item -fs @var{limit_size}
  63. Set the file size limit.
  64. @item -ss @var{position}
  65. Seek to given time position in seconds.
  66. @code{hh:mm:ss[.xxx]} syntax is also supported.
  67. @item -itsoffset @var{offset}
  68. Set the input time offset in seconds.
  69. @code{[-]hh:mm:ss[.xxx]} syntax is also supported.
  70. This option affects all the input files that follow it.
  71. The offset is added to the timestamps of the input files.
  72. Specifying a positive offset means that the corresponding
  73. streams are delayed by 'offset' seconds.
  74. @item -timestamp @var{time}
  75. Set the recording timestamp in the container.
  76. The syntax for @var{time} is:
  77. @example
  78. now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH[:MM[:SS[.m...]]])|(HH[MM[SS[.m...]]]))[Z|z])
  79. @end example
  80. If the value is "now" it takes the current time.
  81. Time is local time unless 'Z' or 'z' is appended, in which case it is
  82. interpreted as UTC.
  83. If the year-month-day part is not specified it takes the current
  84. year-month-day.
  85. @item -metadata @var{key}=@var{value}
  86. Set a metadata key/value pair.
  87. For example, for setting the title in the output file:
  88. @example
  89. ffmpeg -i in.avi -metadata title="my title" out.flv
  90. @end example
  91. @item -v @var{number}
  92. Set the logging verbosity level.
  93. @item -target @var{type}
  94. Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
  95. "ntsc-svcd", ... ). All the format options (bitrate, codecs,
  96. buffer sizes) are then set automatically. You can just type:
  97. @example
  98. ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
  99. @end example
  100. Nevertheless you can specify additional options as long as you know
  101. they do not conflict with the standard, as in:
  102. @example
  103. ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
  104. @end example
  105. @item -dframes @var{number}
  106. Set the number of data frames to record.
  107. @item -scodec @var{codec}
  108. Force subtitle codec ('copy' to copy stream).
  109. @item -newsubtitle
  110. Add a new subtitle stream to the current output stream.
  111. @item -slang @var{code}
  112. Set the ISO 639 language code (3 letters) of the current subtitle stream.
  113. @end table
  114. @section Video Options
  115. @table @option
  116. @item -b @var{bitrate}
  117. Set the video bitrate in bit/s (default = 200 kb/s).
  118. @item -vframes @var{number}
  119. Set the number of video frames to record.
  120. @item -r @var{fps}
  121. Set frame rate (Hz value, fraction or abbreviation), (default = 25).
  122. @item -s @var{size}
  123. Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source).
  124. The following abbreviations are recognized:
  125. @table @samp
  126. @item sqcif
  127. 128x96
  128. @item qcif
  129. 176x144
  130. @item cif
  131. 352x288
  132. @item 4cif
  133. 704x576
  134. @item 16cif
  135. 1408x1152
  136. @item qqvga
  137. 160x120
  138. @item qvga
  139. 320x240
  140. @item vga
  141. 640x480
  142. @item svga
  143. 800x600
  144. @item xga
  145. 1024x768
  146. @item uxga
  147. 1600x1200
  148. @item qxga
  149. 2048x1536
  150. @item sxga
  151. 1280x1024
  152. @item qsxga
  153. 2560x2048
  154. @item hsxga
  155. 5120x4096
  156. @item wvga
  157. 852x480
  158. @item wxga
  159. 1366x768
  160. @item wsxga
  161. 1600x1024
  162. @item wuxga
  163. 1920x1200
  164. @item woxga
  165. 2560x1600
  166. @item wqsxga
  167. 3200x2048
  168. @item wquxga
  169. 3840x2400
  170. @item whsxga
  171. 6400x4096
  172. @item whuxga
  173. 7680x4800
  174. @item cga
  175. 320x200
  176. @item ega
  177. 640x350
  178. @item hd480
  179. 852x480
  180. @item hd720
  181. 1280x720
  182. @item hd1080
  183. 1920x1080
  184. @end table
  185. @item -aspect @var{aspect}
  186. Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
  187. @item -croptop @var{size}
  188. @item -cropbottom @var{size}
  189. @item -cropleft @var{size}
  190. @item -cropright @var{size}
  191. All the crop options have been removed. Use -vf
  192. crop=width:height:x:y instead.
  193. @item -padtop @var{size}
  194. @item -padbottom @var{size}
  195. @item -padleft @var{size}
  196. @item -padright @var{size}
  197. @item -padcolor @var{hex_color}
  198. All the pad options have been removed. Use -vf
  199. pad=width:height:x:y:color instead.
  200. @item -vn
  201. Disable video recording.
  202. @item -bt @var{tolerance}
  203. Set video bitrate tolerance (in bits, default 4000k).
  204. Has a minimum value of: (target_bitrate/target_framerate).
  205. In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
  206. willing to deviate from the target average bitrate value. This is
  207. not related to min/max bitrate. Lowering tolerance too much has
  208. an adverse effect on quality.
  209. @item -maxrate @var{bitrate}
  210. Set max video bitrate (in bit/s).
  211. Requires -bufsize to be set.
  212. @item -minrate @var{bitrate}
  213. Set min video bitrate (in bit/s).
  214. Most useful in setting up a CBR encode:
  215. @example
  216. ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
  217. @end example
  218. It is of little use elsewise.
  219. @item -bufsize @var{size}
  220. Set video buffer verifier buffer size (in bits).
  221. @item -vcodec @var{codec}
  222. Force video codec to @var{codec}. Use the @code{copy} special value to
  223. tell that the raw codec data must be copied as is.
  224. @item -sameq
  225. Use same video quality as source (implies VBR).
  226. @item -pass @var{n}
  227. Select the pass number (1 or 2). It is used to do two-pass
  228. video encoding. The statistics of the video are recorded in the first
  229. pass into a log file (see also the option -passlogfile),
  230. and in the second pass that log file is used to generate the video
  231. at the exact requested bitrate.
  232. On pass 1, you may just deactivate audio and set output to null,
  233. examples for Windows and Unix:
  234. @example
  235. ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
  236. ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
  237. @end example
  238. @item -passlogfile @var{prefix}
  239. Set two-pass log file name prefix to @var{prefix}, the default file name
  240. prefix is ``ffmpeg2pass''. The complete file name will be
  241. @file{PREFIX-N.log}, where N is a number specific to the output
  242. stream.
  243. @item -newvideo
  244. Add a new video stream to the current output stream.
  245. @item -vlang @var{code}
  246. Set the ISO 639 language code (3 letters) of the current video stream.
  247. @item -vf @var{filter_graph}
  248. @var{filter_graph} is a description of the filter graph to apply to
  249. the input video.
  250. Use the option "-filters" to show all the available filters (including
  251. also sources and sinks).
  252. @end table
  253. @section Advanced Video Options
  254. @table @option
  255. @item -pix_fmt @var{format}
  256. Set pixel format. Use 'list' as parameter to show all the supported
  257. pixel formats.
  258. @item -sws_flags @var{flags}
  259. Set SwScaler flags.
  260. @item -g @var{gop_size}
  261. Set the group of pictures size.
  262. @item -intra
  263. Use only intra frames.
  264. @item -vdt @var{n}
  265. Discard threshold.
  266. @item -qscale @var{q}
  267. Use fixed video quantizer scale (VBR).
  268. @item -qmin @var{q}
  269. minimum video quantizer scale (VBR)
  270. @item -qmax @var{q}
  271. maximum video quantizer scale (VBR)
  272. @item -qdiff @var{q}
  273. maximum difference between the quantizer scales (VBR)
  274. @item -qblur @var{blur}
  275. video quantizer scale blur (VBR) (range 0.0 - 1.0)
  276. @item -qcomp @var{compression}
  277. video quantizer scale compression (VBR) (default 0.5).
  278. Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
  279. @item -lmin @var{lambda}
  280. minimum video lagrange factor (VBR)
  281. @item -lmax @var{lambda}
  282. max video lagrange factor (VBR)
  283. @item -mblmin @var{lambda}
  284. minimum macroblock quantizer scale (VBR)
  285. @item -mblmax @var{lambda}
  286. maximum macroblock quantizer scale (VBR)
  287. These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
  288. but you may use the QP2LAMBDA constant to easily convert from 'q' units:
  289. @example
  290. ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
  291. @end example
  292. @item -rc_init_cplx @var{complexity}
  293. initial complexity for single pass encoding
  294. @item -b_qfactor @var{factor}
  295. qp factor between P- and B-frames
  296. @item -i_qfactor @var{factor}
  297. qp factor between P- and I-frames
  298. @item -b_qoffset @var{offset}
  299. qp offset between P- and B-frames
  300. @item -i_qoffset @var{offset}
  301. qp offset between P- and I-frames
  302. @item -rc_eq @var{equation}
  303. Set rate control equation (see section "Expression Evaluation")
  304. (default = @code{tex^qComp}).
  305. When computing the rate control equation expression, besides the
  306. standard functions defined in the section "Expression Evaluation", the
  307. following functions are available:
  308. @table @var
  309. @item bits2qp(bits)
  310. @item qp2bits(qp)
  311. @end table
  312. and the following constants are available:
  313. @table @var
  314. @item iTex
  315. @item pTex
  316. @item tex
  317. @item mv
  318. @item fCode
  319. @item iCount
  320. @item mcVar
  321. @item var
  322. @item isI
  323. @item isP
  324. @item isB
  325. @item avgQP
  326. @item qComp
  327. @item avgIITex
  328. @item avgPITex
  329. @item avgPPTex
  330. @item avgBPTex
  331. @item avgTex
  332. @end table
  333. @item -rc_override @var{override}
  334. rate control override for specific intervals
  335. @item -me_method @var{method}
  336. Set motion estimation method to @var{method}.
  337. Available methods are (from lowest to best quality):
  338. @table @samp
  339. @item zero
  340. Try just the (0, 0) vector.
  341. @item phods
  342. @item log
  343. @item x1
  344. @item hex
  345. @item umh
  346. @item epzs
  347. (default method)
  348. @item full
  349. exhaustive search (slow and marginally better than epzs)
  350. @end table
  351. @item -dct_algo @var{algo}
  352. Set DCT algorithm to @var{algo}. Available values are:
  353. @table @samp
  354. @item 0
  355. FF_DCT_AUTO (default)
  356. @item 1
  357. FF_DCT_FASTINT
  358. @item 2
  359. FF_DCT_INT
  360. @item 3
  361. FF_DCT_MMX
  362. @item 4
  363. FF_DCT_MLIB
  364. @item 5
  365. FF_DCT_ALTIVEC
  366. @end table
  367. @item -idct_algo @var{algo}
  368. Set IDCT algorithm to @var{algo}. Available values are:
  369. @table @samp
  370. @item 0
  371. FF_IDCT_AUTO (default)
  372. @item 1
  373. FF_IDCT_INT
  374. @item 2
  375. FF_IDCT_SIMPLE
  376. @item 3
  377. FF_IDCT_SIMPLEMMX
  378. @item 4
  379. FF_IDCT_LIBMPEG2MMX
  380. @item 5
  381. FF_IDCT_PS2
  382. @item 6
  383. FF_IDCT_MLIB
  384. @item 7
  385. FF_IDCT_ARM
  386. @item 8
  387. FF_IDCT_ALTIVEC
  388. @item 9
  389. FF_IDCT_SH4
  390. @item 10
  391. FF_IDCT_SIMPLEARM
  392. @end table
  393. @item -er @var{n}
  394. Set error resilience to @var{n}.
  395. @table @samp
  396. @item 1
  397. FF_ER_CAREFUL (default)
  398. @item 2
  399. FF_ER_COMPLIANT
  400. @item 3
  401. FF_ER_AGGRESSIVE
  402. @item 4
  403. FF_ER_VERY_AGGRESSIVE
  404. @end table
  405. @item -ec @var{bit_mask}
  406. Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
  407. the following values:
  408. @table @samp
  409. @item 1
  410. FF_EC_GUESS_MVS (default = enabled)
  411. @item 2
  412. FF_EC_DEBLOCK (default = enabled)
  413. @end table
  414. @item -bf @var{frames}
  415. Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
  416. @item -mbd @var{mode}
  417. macroblock decision
  418. @table @samp
  419. @item 0
  420. FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
  421. @item 1
  422. FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
  423. @item 2
  424. FF_MB_DECISION_RD: rate distortion
  425. @end table
  426. @item -4mv
  427. Use four motion vector by macroblock (MPEG-4 only).
  428. @item -part
  429. Use data partitioning (MPEG-4 only).
  430. @item -bug @var{param}
  431. Work around encoder bugs that are not auto-detected.
  432. @item -strict @var{strictness}
  433. How strictly to follow the standards.
  434. @item -aic
  435. Enable Advanced intra coding (h263+).
  436. @item -umv
  437. Enable Unlimited Motion Vector (h263+)
  438. @item -deinterlace
  439. Deinterlace pictures.
  440. @item -ilme
  441. Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
  442. Use this option if your input file is interlaced and you want
  443. to keep the interlaced format for minimum losses.
  444. The alternative is to deinterlace the input stream with
  445. @option{-deinterlace}, but deinterlacing introduces losses.
  446. @item -psnr
  447. Calculate PSNR of compressed frames.
  448. @item -vstats
  449. Dump video coding statistics to @file{vstats_HHMMSS.log}.
  450. @item -vstats_file @var{file}
  451. Dump video coding statistics to @var{file}.
  452. @item -top @var{n}
  453. top=1/bottom=0/auto=-1 field first
  454. @item -dc @var{precision}
  455. Intra_dc_precision.
  456. @item -vtag @var{fourcc/tag}
  457. Force video tag/fourcc.
  458. @item -qphist
  459. Show QP histogram.
  460. @item -vbsf @var{bitstream_filter}
  461. Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump", "mjpeg2jpeg".
  462. @example
  463. ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
  464. @end example
  465. @item -force_key_frames @var{time}[,@var{time}...]
  466. Force key frames at the specified timestamps, more precisely at the first
  467. frames after each specified time.
  468. This option can be useful to ensure that a seek point is present at a
  469. chapter mark or any other designated place in the output file.
  470. The timestamps must be specified in ascending order.
  471. @end table
  472. @section Audio Options
  473. @table @option
  474. @item -aframes @var{number}
  475. Set the number of audio frames to record.
  476. @item -ar @var{freq}
  477. Set the audio sampling frequency (default = 44100 Hz).
  478. @item -ab @var{bitrate}
  479. Set the audio bitrate in bit/s (default = 64k).
  480. @item -aq @var{q}
  481. Set the audio quality (codec-specific, VBR).
  482. @item -ac @var{channels}
  483. Set the number of audio channels. For input streams it is set by
  484. default to 1, for output streams it is set by default to the same
  485. number of audio channels in input. If the input file has audio streams
  486. with different channel count, the behaviour is undefined.
  487. @item -an
  488. Disable audio recording.
  489. @item -acodec @var{codec}
  490. Force audio codec to @var{codec}. Use the @code{copy} special value to
  491. specify that the raw codec data must be copied as is.
  492. @item -newaudio
  493. Add a new audio track to the output file. If you want to specify parameters,
  494. do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
  495. Mapping will be done automatically, if the number of output streams is equal to
  496. the number of input streams, else it will pick the first one that matches. You
  497. can override the mapping using @code{-map} as usual.
  498. Example:
  499. @example
  500. ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
  501. @end example
  502. @item -alang @var{code}
  503. Set the ISO 639 language code (3 letters) of the current audio stream.
  504. @end table
  505. @section Advanced Audio options:
  506. @table @option
  507. @item -atag @var{fourcc/tag}
  508. Force audio tag/fourcc.
  509. @item -absf @var{bitstream_filter}
  510. Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
  511. @end table
  512. @section Subtitle options:
  513. @table @option
  514. @item -scodec @var{codec}
  515. Force subtitle codec ('copy' to copy stream).
  516. @item -newsubtitle
  517. Add a new subtitle stream to the current output stream.
  518. @item -slang @var{code}
  519. Set the ISO 639 language code (3 letters) of the current subtitle stream.
  520. @item -sn
  521. Disable subtitle recording.
  522. @item -sbsf @var{bitstream_filter}
  523. Bitstream filters available are "mov2textsub", "text2movsub".
  524. @example
  525. ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
  526. @end example
  527. @end table
  528. @section Audio/Video grab options
  529. @table @option
  530. @item -vc @var{channel}
  531. Set video grab channel (DV1394 only).
  532. @item -tvstd @var{standard}
  533. Set television standard (NTSC, PAL (SECAM)).
  534. @item -isync
  535. Synchronize read on input.
  536. @end table
  537. @section Advanced options
  538. @table @option
  539. @item -map @var{input_stream_id}[:@var{sync_stream_id}]
  540. Set stream mapping from input streams to output streams.
  541. Just enumerate the input streams in the order you want them in the output.
  542. @var{sync_stream_id} if specified sets the input stream to sync
  543. against.
  544. @item -map_meta_data @var{outfile}[,@var{metadata}]:@var{infile}[,@var{metadata}]
  545. Set meta data information of @var{outfile} from @var{infile}. Note that those
  546. are file indices (zero-based), not filenames.
  547. Optional @var{metadata} parameters specify, which metadata to copy - (g)lobal
  548. (i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
  549. per-(p)rogram. All metadata specifiers other than global must be followed by the
  550. stream/chapter/program number. If metadata specifier is omitted, it defaults to
  551. global.
  552. By default, global metadata is copied from the first input file to all output files,
  553. per-stream and per-chapter metadata is copied along with streams/chapters. These
  554. default mappings are disabled by creating any mapping of the relevant type. A negative
  555. file index can be used to create a dummy mapping that just disables automatic copying.
  556. For example to copy metadata from the first stream of the input file to global metadata
  557. of the output file:
  558. @example
  559. ffmpeg -i in.ogg -map_meta_data 0:0,s0 out.mp3
  560. @end example
  561. @item -map_chapters @var{outfile}:@var{infile}
  562. Copy chapters from @var{infile} to @var{outfile}. If no chapter mapping is specified,
  563. then chapters are copied from the first input file with at least one chapter to all
  564. output files. Use a negative file index to disable any chapter copying.
  565. @item -debug
  566. Print specific debug info.
  567. @item -benchmark
  568. Show benchmarking information at the end of an encode.
  569. Shows CPU time used and maximum memory consumption.
  570. Maximum memory consumption is not supported on all systems,
  571. it will usually display as 0 if not supported.
  572. @item -dump
  573. Dump each input packet.
  574. @item -hex
  575. When dumping packets, also dump the payload.
  576. @item -bitexact
  577. Only use bit exact algorithms (for codec testing).
  578. @item -ps @var{size}
  579. Set RTP payload size in bytes.
  580. @item -re
  581. Read input at native frame rate. Mainly used to simulate a grab device.
  582. @item -loop_input
  583. Loop over the input stream. Currently it works only for image
  584. streams. This option is used for automatic FFserver testing.
  585. @item -loop_output @var{number_of_times}
  586. Repeatedly loop output for formats that support looping such as animated GIF
  587. (0 will loop the output infinitely).
  588. @item -threads @var{count}
  589. Thread count.
  590. @item -vsync @var{parameter}
  591. Video sync method.
  592. 0 Each frame is passed with its timestamp from the demuxer to the muxer
  593. 1 Frames will be duplicated and dropped to achieve exactly the requested
  594. constant framerate.
  595. 2 Frames are passed through with their timestamp or dropped so as to prevent
  596. 2 frames from having the same timestamp
  597. -1 Chooses between 1 and 2 depending on muxer capabilities. This is the default method.
  598. With -map you can select from
  599. which stream the timestamps should be taken. You can leave either video or
  600. audio unchanged and sync the remaining stream(s) to the unchanged one.
  601. @item -async @var{samples_per_second}
  602. Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
  603. the parameter is the maximum samples per second by which the audio is changed.
  604. -async 1 is a special case where only the start of the audio stream is corrected
  605. without any later correction.
  606. @item -copyts
  607. Copy timestamps from input to output.
  608. @item -shortest
  609. Finish encoding when the shortest input stream ends.
  610. @item -dts_delta_threshold
  611. Timestamp discontinuity delta threshold.
  612. @item -muxdelay @var{seconds}
  613. Set the maximum demux-decode delay.
  614. @item -muxpreload @var{seconds}
  615. Set the initial demux-decode delay.
  616. @item -streamid @var{output-stream-index}:@var{new-value}
  617. Assign a new value to a stream's stream-id field in the next output file.
  618. All stream-id fields are reset to default for each output file.
  619. For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
  620. an output mpegts file:
  621. @example
  622. ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
  623. @end example
  624. @end table
  625. @section Preset files
  626. A preset file contains a sequence of @var{option}=@var{value} pairs,
  627. one for each line, specifying a sequence of options which would be
  628. awkward to specify on the command line. Lines starting with the hash
  629. ('#') character are ignored and are used to provide comments. Check
  630. the @file{ffpresets} directory in the FFmpeg source tree for examples.
  631. Preset files are specified with the @code{vpre}, @code{apre},
  632. @code{spre}, and @code{fpre} options. The @code{fpre} option takes the
  633. filename of the preset instead of a preset name as input and can be
  634. used for any kind of codec. For the @code{vpre}, @code{apre}, and
  635. @code{spre} options, the options specified in a preset file are
  636. applied to the currently selected codec of the same type as the preset
  637. option.
  638. The argument passed to the @code{vpre}, @code{apre}, and @code{spre}
  639. preset options identifies the preset file to use according to the
  640. following rules:
  641. First ffmpeg searches for a file named @var{arg}.ffpreset in the
  642. directories @file{$FFMPEG_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in
  643. the datadir defined at configuration time (usually @file{PREFIX/share/ffmpeg})
  644. in that order. For example, if the argument is @code{libx264-max}, it will
  645. search for the file @file{libx264-max.ffpreset}.
  646. If no such file is found, then ffmpeg will search for a file named
  647. @var{codec_name}-@var{arg}.ffpreset in the above-mentioned
  648. directories, where @var{codec_name} is the name of the codec to which
  649. the preset file options will be applied. For example, if you select
  650. the video codec with @code{-vcodec libx264} and use @code{-vpre max},
  651. then it will search for the file @file{libx264-max.ffpreset}.
  652. @c man end
  653. @chapter Tips
  654. @c man begin TIPS
  655. @itemize
  656. @item
  657. For streaming at very low bitrate application, use a low frame rate
  658. and a small GOP size. This is especially true for RealVideo where
  659. the Linux player does not seem to be very fast, so it can miss
  660. frames. An example is:
  661. @example
  662. ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
  663. @end example
  664. @item
  665. The parameter 'q' which is displayed while encoding is the current
  666. quantizer. The value 1 indicates that a very good quality could
  667. be achieved. The value 31 indicates the worst quality. If q=31 appears
  668. too often, it means that the encoder cannot compress enough to meet
  669. your bitrate. You must either increase the bitrate, decrease the
  670. frame rate or decrease the frame size.
  671. @item
  672. If your computer is not fast enough, you can speed up the
  673. compression at the expense of the compression ratio. You can use
  674. '-me zero' to speed up motion estimation, and '-intra' to disable
  675. motion estimation completely (you have only I-frames, which means it
  676. is about as good as JPEG compression).
  677. @item
  678. To have very low audio bitrates, reduce the sampling frequency
  679. (down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
  680. @item
  681. To have a constant quality (but a variable bitrate), use the option
  682. '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
  683. quality).
  684. @item
  685. When converting video files, you can use the '-sameq' option which
  686. uses the same quality factor in the encoder as in the decoder.
  687. It allows almost lossless encoding.
  688. @end itemize
  689. @c man end TIPS
  690. @chapter Examples
  691. @c man begin EXAMPLES
  692. @section Video and Audio grabbing
  693. FFmpeg can grab video and audio from devices given that you specify the input
  694. format and device.
  695. @example
  696. ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
  697. @end example
  698. Note that you must activate the right video source and channel before
  699. launching FFmpeg with any TV viewer such as xawtv
  700. (@url{http://linux.bytesex.org/xawtv/}) by Gerd Knorr. You also
  701. have to set the audio recording levels correctly with a
  702. standard mixer.
  703. @section X11 grabbing
  704. FFmpeg can grab the X11 display.
  705. @example
  706. ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
  707. @end example
  708. 0.0 is display.screen number of your X11 server, same as
  709. the DISPLAY environment variable.
  710. @example
  711. ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
  712. @end example
  713. 0.0 is display.screen number of your X11 server, same as the DISPLAY environment
  714. variable. 10 is the x-offset and 20 the y-offset for the grabbing.
  715. @section Video and Audio file format conversion
  716. * FFmpeg can use any supported file format and protocol as input:
  717. Examples:
  718. * You can use YUV files as input:
  719. @example
  720. ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
  721. @end example
  722. It will use the files:
  723. @example
  724. /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
  725. /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
  726. @end example
  727. The Y files use twice the resolution of the U and V files. They are
  728. raw files, without header. They can be generated by all decent video
  729. decoders. You must specify the size of the image with the @option{-s} option
  730. if FFmpeg cannot guess it.
  731. * You can input from a raw YUV420P file:
  732. @example
  733. ffmpeg -i /tmp/test.yuv /tmp/out.avi
  734. @end example
  735. test.yuv is a file containing raw YUV planar data. Each frame is composed
  736. of the Y plane followed by the U and V planes at half vertical and
  737. horizontal resolution.
  738. * You can output to a raw YUV420P file:
  739. @example
  740. ffmpeg -i mydivx.avi hugefile.yuv
  741. @end example
  742. * You can set several input files and output files:
  743. @example
  744. ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
  745. @end example
  746. Converts the audio file a.wav and the raw YUV video file a.yuv
  747. to MPEG file a.mpg.
  748. * You can also do audio and video conversions at the same time:
  749. @example
  750. ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
  751. @end example
  752. Converts a.wav to MPEG audio at 22050 Hz sample rate.
  753. * You can encode to several formats at the same time and define a
  754. mapping from input stream to output streams:
  755. @example
  756. ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
  757. @end example
  758. Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
  759. file:index' specifies which input stream is used for each output
  760. stream, in the order of the definition of output streams.
  761. * You can transcode decrypted VOBs:
  762. @example
  763. ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
  764. @end example
  765. This is a typical DVD ripping example; the input is a VOB file, the
  766. output an AVI file with MPEG-4 video and MP3 audio. Note that in this
  767. command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
  768. GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
  769. input video. Furthermore, the audio stream is MP3-encoded so you need
  770. to enable LAME support by passing @code{--enable-libmp3lame} to configure.
  771. The mapping is particularly useful for DVD transcoding
  772. to get the desired audio language.
  773. NOTE: To see the supported input formats, use @code{ffmpeg -formats}.
  774. * You can extract images from a video, or create a video from many images:
  775. For extracting images from a video:
  776. @example
  777. ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
  778. @end example
  779. This will extract one video frame per second from the video and will
  780. output them in files named @file{foo-001.jpeg}, @file{foo-002.jpeg},
  781. etc. Images will be rescaled to fit the new WxH values.
  782. If you want to extract just a limited number of frames, you can use the
  783. above command in combination with the -vframes or -t option, or in
  784. combination with -ss to start extracting from a certain point in time.
  785. For creating a video from many images:
  786. @example
  787. ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
  788. @end example
  789. The syntax @code{foo-%03d.jpeg} specifies to use a decimal number
  790. composed of three digits padded with zeroes to express the sequence
  791. number. It is the same syntax supported by the C printf function, but
  792. only formats accepting a normal integer are suitable.
  793. * You can put many streams of the same type in the output:
  794. @example
  795. ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio
  796. @end example
  797. In addition to the first video and audio streams, the resulting
  798. output file @file{test12.avi} will contain the second video
  799. and the second audio stream found in the input streams list.
  800. The @code{-newvideo}, @code{-newaudio} and @code{-newsubtitle}
  801. options have to be specified immediately after the name of the output
  802. file to which you want to add them.
  803. @c man end EXAMPLES
  804. @include eval.texi
  805. @include indevs.texi
  806. @include outdevs.texi
  807. @include protocols.texi
  808. @include bitstream_filters.texi
  809. @include filters.texi
  810. @include metadata.texi
  811. @ignore
  812. @setfilename ffmpeg
  813. @settitle FFmpeg video converter
  814. @c man begin SEEALSO
  815. ffplay(1), ffprobe(1), ffserver(1) and the FFmpeg HTML documentation
  816. @c man end
  817. @c man begin AUTHORS
  818. The FFmpeg developers
  819. @c man end
  820. @end ignore
  821. @bye