잠시만 기다려 주세요

HOME   |  여기는?   |  바다물때표   |  여러가지 팁 (888)  |  추천 및 재미 (154)  |  자료실 (20)  |  끄적거림 (520)  |  시나리오 (760)  |  드라마 대본 (248)  |  

2020년 09월 25일
하루 한개씩 1년이면 365개의 일을 할 수 있다. 하루 하나씩만이라도 무언가를 해 보는 습관이 필요하다. - 바다아이
 




    리눅스 데스크탑

리눅스 데스크탑 - Useful FFmpeg 사용법 Commands, 동영상 컨버트, movie convert
이 름 : 바다아이   |   조회수 : 2506         짧은 주소 : https://www.bada-ie.com/su/?171591938375
FFmpeg is an extremely powerful and versatile command line tool for converting audio and video files. It is free and available for Windows, Mac and Linux machines. Whether you want to join two video files, extract the audio component from a video file, convert your video into an animated GIF, FFmpeg can do it all and even more.

Useful FFmpeg Commands

FFmpeg supports all popular audio and video formats. Or you can running the command ./ffmpeg -formats to get a list of every format that is supported by your FFmpeg installation. If you are just getting started, here are some commands that will give you good idea of the capabilities of this tool.

1. Cut video file into a smaller clip

You can use the time offset parameter (-ss) to specify the start time stamp in HH:MM:SS.ms format while the -t parameter is for specifying the actual duration of the clip in seconds.

ffmpeg -i input.mp4 -ss 00:00:50.0 -codec copy -t 20 output.mp4

2. Split a video into multiple parts

If you want to split a large video into multiple smaller clips without re-encoding, ffmpeg can help. This command will split the source video into 2 parts – one ending at 50s from the start and the other beginning at 50s and ending at the end of the input video.

ffmpeg -i video.mp4 -t 00:00:50 -c copy small-1.mp4 -ss 00:00:50 -codec copy small-2.mp4

3. Convert video from one format to another

You can use the -vcodec parameter to specify the encoding format to be used for the output video. Encoding a video takes time but you can speed up the process by forcing a preset though it would degrade the quality of the output video.

ffmpeg -i youtube.flv -c:v libx264 filename.mp4

ffmpeg -i video.wmv -c:v libx264 -preset ultrafast video.mp4


4. Join (concatenate) video files

If you have multiple audio or video files encoded with the same codecs, you can join them into a single file using FFmpeg. Create a input file with a list of all source files that you wish to concatenate and then run this command.

ffmpeg -f concat -i file-list.txt -c copy output.mp4

5. Mute a video (Remove the audio component)

Use the -an parameter to disable the audio portion of a video stream.

ffmpeg -i video.mp4 -an mute-video.mp4

6. Extract the audio from video

The -vn switch extracts the audio portion from a video and we are using the -ab switch to save the audio as a 256kbps MP3 audio file.

ffmpeg -i video.mp4 -vn -ab 256 audio.mp3

7. Convert a video into animated GIF

FFmpeg is an excellent tool for converting videos into animated GIFs and the quality isn’t bad either. Use the scale filter to specify the width of the GIF, the -t parameter specific the duration while -r specifies the frame rate (fps).

ffmpeg -i video.mp4 -vf scale=500:-1 -t 10 -r 10 image.gif

8. Extract image frames from a video

This command will extract the video frame at the 15s mark and saves it as a 800px wide JPEG image. You can also use the -s switch (like -s 400×300) to specify the exact dimensions of the image file though it will probably create a stretched image if the image size doesn’t follow the aspect ratio of the original video file.

ffmpeg -ss 00:00:15 -i video.mp4 -vf scale=800:-1 -vframes 1 image.jpg

9. Convert Video into Images

You can use FFmpeg to automatically extract image frames from a video every ‘n’ seconds and the images are saved in a sequence. This command saves image frame after every 4 seconds.

ffmpeg -i movie.mp4 -r 0.25 frames_%04d.png

10. Merge an audio and video file

You can also specify the -shortest switch to finish the encoding when the shortest clip ends.

ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -strict experimental output.mp4

ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -strict experimental -shortest output.mp4


11. Resize a video

Use the size (-s) switch with ffmpeg to resize a video while maintaining the aspect ratio.

ffmpeg -i input.mp4 -s 480x320 -c:a copy output.mp4

12. Create video slideshow from images

This command creates a video slideshow using a series of images that are named as img001.png, img002.png, etc. Each image will have a duration of 5 seconds (-r 1/5).

ffmpeg -r 1/5 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p slideshow.mp4

13. Add a poster image to audio

You can add a cover image to an audio file and the length of the output video will be the same as that of the input audio stream. This may come handy for uploading MP3s to YouTube.

ffmpeg -loop 1 -i image.jpg -i audio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4

14. Convert a single image into a video

Use the -t parameter to specify the duration of the video.

ffmpeg -loop 1 -i image.png -c:v libx264 -t 30 -pix_fmt yuv420p video.mp4

15. Add subtitles to a movie

This will take the subtitles from the .srt file. FFmpeg can decode most common subtitle formats.

ffmpeg -i movie.mp4 -i subtitles.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mkv

16. Crop an audio file

This will create a 30 second audio file starting at 90 seconds from the original audio file without transcoding.

ffmpeg -ss 00:01:30 -t 30 -acodec copy -i inputfile.mp3 outputfile.mp3

17. Change the audio volume

You can use the volume filter to alter the volume of a media file using FFmpeg. This command will half the volume of the audio file.

ffmpeg -i input.wav -af 'volume=0.5' output.wav

18. Rotate a video

This command will rotate a video clip 90° clockwise. You can set transpose to 2 to rotate the video 90° anti-clockwise.

ffmpeg -i input.mp4 -filter:v 'transpose=1' rotated-video.mp4

This will rotate the video 180° counter-clockwise.

ffmpeg -i input.mp4 -filter:v 'transpose=2,transpose=2' rotated-video.mp4

19. Speed up or Slow down the video

You can change the speed of your video using the setpts (set presentation time stamp) filter of FFmpeg. This command will make the video 8x (1/8) faster or use setpts=4*PTS to make the video 4x slower.

ffmpeg -i input.mp4 -filter:v "setpts=0.125*PTS" output.mp4

20. Speed up or Slow down the audio

For changing the speed of audio, use the atempo audio filter. This command will double the speed of audio. You can use any value between 0.5 and 2.0 for audio.

ffmpeg -i input.mkv -filter:a "atempo=2.0" -vn output.mkv

Stack Exchange has a good overview to get you started with FFmpeg. You should also check out the official documentation at ffmpeg.org or the wiki at trac.ffmpeg.org to know about all the possible things you can do with FFmpeg.


출처 : https://www.labnol.org/internet/useful-ffmpeg-commands/28490/
 
| |


      1 page / 7 page
번 호 카테고리 제 목 이름 조회수
189 리눅스 데스크탑 ... ... .... 바다아이 180
188 리눅스 데스크탑 ; & && ||, | 바다아이 267
187 리눅스 데스크탑 , , , 바다아이 257
186 리눅스 데스크탑 ... 바다아이 278
185 리눅스 데스크탑 /etc/fstab 바다아이 284
184 리눅스 데스크탑 ntp , .. ... 바다아이 239
183 리눅스 데스크탑 20.04 64 , ubuntu 20.04 . hwp 바다아이 359
182 리눅스 데스크탑 .... 바다아이 279
181 리눅스 데스크탑 pamac , ... pamac categories package error 바다아이 338
180 리눅스 데스크탑 archlinux pacman ... lock 바다아이 336
179 리눅스 데스크탑 dd 바다아이 672
178 리눅스 데스크탑 vi, vim , .... 바다아이 684
177 리눅스 데스크탑 ubuntu 16.04 4.14 nvidia-304 ... 바다아이 641
176 리눅스 데스크탑 nvidia ... 바다아이 847
175 리눅스 데스크탑 .... 16.04 libssl1.1 ... ubuntu kernel install 바다아이 770
174 리눅스 데스크탑 testdisk 바다아이 1317
173 리눅스 데스크탑 바다아이 1187
172 리눅스 데스크탑 Compiling nVidia 304.137 on Ubuntu 18.04 바다아이 1367
171 리눅스 데스크탑 lightdm , , Lightdm not starting on boot ?? 바다아이 1190
170 리눅스 데스크탑 thunderbird , 바다아이 1228
169 리눅스 데스크탑 usb, cdrom grub iso ... 바다아이 1253
168 리눅스 데스크탑 usb, cdrom grub iso ... 바다아이 1360
167 리눅스 데스크탑 dd , 바다아이 1387
166 리눅스 데스크탑 , dd if=/dev/zero, . low format 바다아이 1974
165 리눅스 데스크탑 freebsd ufs , linux ufs mount 바다아이 1708
164 리눅스 데스크탑 Arch on WSL, archlinux libQt5Core.so.5 not found 바다아이 1462
163 리눅스 데스크탑 , .... input text ... font 바다아이 1836
162 리눅스 데스크탑 ... 바다아이 1740
161 리눅스 데스크탑 , , .. gparted 바다아이 1995
160 리눅스 데스크탑 ssh .... ssh .. 바다아이 1717
| |








Copyright ⓒ 2001.12. bada-ie.com. All rights reserved.
이 사이트는 리눅스에서 firefox 기준으로 작성되었습니다. 기타 브라우저에서는 다르게 보일 수 있습니다.
[ FreeBSD + GoLang + PostgreSQL ]
서버위치 : vultr.com 서울  실행시간 : 0.25144
to webmaster... gogo sea. gogo sea.