3. Example of ffmpeg command to convert synthetic audio and video files

Test file:
Link: https://pan.baidu.com/s/1_8S-ZUssdmnJ93Hu59Ks-Q
Extraction code: tbin

0. Video format conversion:
//Convert .264 format to avi:
ffmpeg -i test.264 test.avi --success
//Convert .264 format to flv:
ffmpeg -i test.264 test.flv --success
//Convert .264 format to mp4:
ffmpeg -i test.264 test.mp4 --success
//Convert .264 format to mpg:
ffmpeg -i test.264 test.mpg --success

1. Get the video information
ffprobe frozen.mp4

2.
Combine the picture sequence into the video ffmpeg -f image2 -i image%d.jpg test.mpg The
above command will merge the pictures in the current directory (names such as image1.jpg. image2.jpg. etc...) into test. mpg

3. Decompose the video into a picture sequence
ffmpeg -i test.mpg image%d.jpg The
above command will generate image1.jpg. image2.jpg. …
supported picture formats are: PGM. PPM. PAM. PGMYUV. JPEG. GIF . PNG. TIFF. SGI

4. Re-encode the video to be suitable for playback on iPod/iPhone
//

5. Re-encode the video to be suitable for playback on PSP
//

6. Extract the sound from the video. And
save it as Mp3 ffmpeg -i frozen.mp4 -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.mp3
Description:

  • Source video: frozen.mp4
  • Audio bit rate: 192kb/s
  • Output format: mp3
  • Generated sound: sound.mp3

7. General wav text conversion Mp3
ffmpeg -i son_origine.wav -vn -ar 44100 -ac 2 -ab 192 -f mp3 son_final.mp3

8. Convert .avi video to .mpg
ffmpeg -i video_origine.avi video_finale.mpg

9. Convert .mpg to .avi
ffmpeg -i video_origine.mpg video_finale.avi

10. Convert .avi to gif animation (uncompressed)
ffmpeg -i frozen.avi gif_frozen.gif


11.Synthesize video and audio ffmpeg -i sound.mp3 -i test.mp4 video_add_audio.mpg
ffmpeg -i sound.mp3 -i test.mp4 video_add_audio.avi

12.将.avi 转成.flv
ffmpeg -i video_add_audio.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv avi_to_flv.flv

13. Convert .avi to dv
ffmpeg -i video_add_audio.avi -s pal -r pal -aspect 4:3 -ar 48000 -ac 2 avi_to_dv.dv
//The generated file is oversized: 6.85MB —>220MB
or:
ffmpeg -i video_add_audio.avi -target pal-dv avi_to_dv2.dv

14. Compress .avi into divx
ffmpeg -i video_add_audio.avi -s 320x240 -vcodec msmpeg4v2 avi_to_divx.avi
//The compressed file is extremely small: 6.85MB —>2.92MB

15. Compress Ogg Theora into Mpeg dvd
ffmpeg -i film_sortie_cinelerra.ogm -s 720x576 -vcodec mpeg2video -acodec mp3 film_terminate.mpg
//not tested

16.将.avi 压缩成 SVCD mpeg2
NTSC 格式:
ffmpeg -i video_add_audio.avi -target ntsc-svcd avi_to_SVCDmpeg2_NTSC.mpg
PAL 格式:
ffmpeg -i video_add_audio.avi -target pal-svcd avi_to_SVCDmpeg2_PAL.mpg

17. Compress .avi into VCD mpeg2
NTSC format:
ffmpeg -i video_add_audio.avi -target ntsc-vcd avi_to_VCD_mpeg2_NTSC.mpg
PAL format:
ffmpeg -i video_add_audio.avi -target pal-vcd avi_to_VCD_mpg2_PAL.

18.从 flv 提取 mp3
ffmpeg -i avi_to_flv.flv -ab 128k mp3_from_flv.mp3

Guess you like

Origin blog.csdn.net/yanghangwww/article/details/104454452