grimoire

personal wiki
git clone git://git.pyratebeard.net/grimoire.git
Log | Files | Refs

ffmpeg.md (1318B)


      1 # ffmpeg
      2 
      3 ### extract audio from video
      4 ```
      5 ffmpeg -i input-video.mkv -q:a 0 -map a output-audio.mp3
      6 ```
      7 
      8 ### remove audio from a video
      9 ```
     10 ffmpeg -i video.mkv -c copy -an video-nosound.mkv
     11 ```
     12 
     13 ### record a video
     14 without audio
     15 ```
     16 ffmpeg -f x11grab -r 15 -i :0.0 -acodec libmp3lame -vcodec mpeg4 -ar 48000 -qscale 0 -framerate 24 outputvideo.avi
     17 ```
     18 
     19 with audio
     20 ```
     21 ffmpeg  -f alsa -ac 2 -i alsa -f x11grab -r 15 -i :0.0 -acodec libmp3lame -vcodec mpeg4 -ar 48000 -qscale 0 -framerate 24 outputvideo.avi
     22 ```
     23 
     24 ### convert video format
     25 ```
     26 ffmpeg -i videofile.mp4 videofile.webm
     27 ```
     28 
     29 ### adjust crf
     30 adjust constant rate factor to lower bit rate
     31 ```
     32 ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4
     33 ```
     34 
     35 ### remove id3 tag image and metadata from audio file
     36 ```
     37 ffmpeg -i input.mp3 -vn -codec:a copy -map_metadata -1 output.mp3
     38 ```
     39 
     40 ### trim start and end of video file
     41 ```
     42 ffmpeg -i input.mp4 -ss 00:00:10 -to 01:23:14 -async 1 -c copy output.mp4
     43 ```
     44 
     45 ### rotate video
     46 * 90° clockwise - increase transpose number for greater rotation
     47 ```
     48 ffmpeg -i input.mp3 -vf "transpose=1" output.mp4
     49 ```
     50 
     51 
     52 ## firefox corrupt file
     53 firefox complains about videos recorded with `ffmpeg`, saying they are corrupt.  apparently using the following options fixes this (mentioned by seninha in #nixers irc)
     54 ```
     55 -vf format=yuv420p
     56 ```