Skip to content

Instantly share code, notes, and snippets.

@fortunto2
Forked from windyinsc/ffmpeg-cheatsheet.md
Created October 4, 2018 13:04
Show Gist options
  • Select an option

  • Save fortunto2/0aee05699d61fd90749d2f85a1d04093 to your computer and use it in GitHub Desktop.

Select an option

Save fortunto2/0aee05699d61fd90749d2f85a1d04093 to your computer and use it in GitHub Desktop.

Revisions

  1. @windyinsc windyinsc revised this gist Aug 17, 2017. 2 changed files with 167 additions and 0 deletions.
    93 changes: 93 additions & 0 deletions ffmpeg-cmd.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,93 @@
    # Source via GitHubGist user [Akagi201](https://gist.github.com/Akagi201/0ead2f811e133130c19f)

    ## video subtitle
    `ffmpeg -i *.mp4 -vf subtitles=*.srt output.mp4`

    ## element stream to ts
    * `ffmpeg -i audio.aac -i ch2.h264 -acodec copy -vcodec copy -f mpegts out.ts`

    ## rtsp 2 rtmp
    * `ffmpeg -rtsp_transport tcp -i rtsp://fuck.com/fuck/fuck -c copy -f flv rtmp://shit.com/shit/shit`

    ## 截图片
    * `./ffmpeg -y -err_detect ignore_err -i "rtmp://uplive.b0.upaiyun.com/live/loading timeout=10" -f image2 -vframes 1 a.jpg`
    * `./ffmpeg -y -err_detect ignore_err -i "rtmp://uplive.b0.upaiyun.com/live/loading live=1 timeout=10" -f image2 -vframes 1 a.jpg`

    ## 推流图片
    * `./ffmpeg -loop 1 -i akhead.jpg -r 10 -f flv rtmp://uplive.v0.upaiyun.com/live/english`

    ## 查看 ffmpeg 全部帮助
    * `ffmpeg --help full`

    ## 推纯音频
    * `ffmpeg -re -i xxx.aac -vn -acodec copy -f flv -y rtmp://xxxx`

    ## 实时转低码率
    * `ffmpeg -i rtmp://10.0.5.135/uplive.b0.upaiyun.com/live/123 -b 1000k -s 960:540 -f flv rtmp://10.0.5.132/uplive.v0.upaiyun.com/live/small`

    ## 循环推流
    * `ffmpeg -re -stream_loop -1 -i time.flv -c copy -f flv o.flv`
    * <http://video.stackexchange.com/questions/12905/repeat-loop-input-video-with-ffmpeg>
    * <http://video.stackexchange.com/questions/18271/issues-looping-a-stream-with-ffmpeg?newsletter=1&nlcode=580354%7cd24e>

    ```
    for((;;)); do \
    ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/hightest_h1080p.mov \
    -vcodec copy -acodec copy \
    -f flv -y rtmp://127.0.0.1:1935/live/livestream; \
    sleep 1; \
    done
    ```

    ## 纯 AAC 推流
    * `ffmpeg -re -i time.aac -bsf:a aac_adtstoasc -c copy -f flv rtmp://uplive.b0.upaiyun.com/live/english`

    ## 转码为低码率
    * `ffmpeg -i time.flv -c libx264 -profile:v high -preset:v slow -b:v 300k -s 640x480 -r 25 -acodec libfdk_aac -ac 2 -b:a 48k -ar 44100 -y time.300kbps.flv`

    ## 切割mp4
    * `ffmpeg -ss 00:00:00 -i mpeg4conformance.mp4 -vcodec copy -acodec copy -t 00:00:10 o.mp4`

    ## 解析所有的帧
    * `ffprobe -show_frames test.mp4`
    * 只要视频 `ffprobe -show_frames -select_streams v:0 test.mp4`
    * <https://trac.ffmpeg.org/wiki/FFprobeTips>
    *

    ## webcam
    * <https://trac.ffmpeg.org/wiki/Capture/Webcam>

    ## 常用命令
    * <http://itindex.net/detail/4071-ffmpeg>

    ## 下载m3u8视频
    * `ffmpeg -i M3U8 URL -c copy mpegts.ts`

    ## 桌面直播
    * `ffmpeg -f x11grab -follow_mouse centered -r 100 -s cif -i :0.0 -f flv $RTMP_PUSH_URL`

    ## 转h.264裸流文件
    * `-acodec none`

    ## watermark
    * <http://www.idude.net/index.php/how-to-watermark-a-video-using-ffmpeg/>
    * <http://video.stackexchange.com/questions/12105/add-an-image-in-front-of-video-using-ffmpeg>
    * <http://superuser.com/questions/678168/add-an-image-as-watermark-to-a-video-file-with-ffmpeg>
    * `ffmpeg -i 1.mp4 -vf “movie=27.png [logo1]; movie=29.png [logo2]; [in][logo1] overlay=40:40:enable=between(t\,2\,3)[tmp]; [tmp][logo2] overlay=40:40:enable=between(t\,4\,5)[filtered]” o.mp4 `
    * 这个分别在2,3秒之间叠加27.png,以及4,5秒之间叠加29.png
    * `ffmpeg -i input.mp4 -i input.png -filter_complex 'overlay=0:0' output.mp4`
    * <http://www.daniel-mitchell.com/blog/video-in-a-video-ffmpeg/>

    ## 使用FFMPEG发布RTSP流
    * 上传: `ffmpeg -i a.mp4 -vcodec libx264 -f rtsp rtsp://127.0.0.1:5050/ok`
    * 接收: `ffmpeg -rtsp_flags listen -f rtsp -i rtsp://127.0.0.1:5050/ok b.mp4`

    ## 压制
    * <http://mariolong01.blogspot.jp/2013/06/ffmpeg.html>
    * <http://vanix.blogspot.jp/2014/01/ffmpeg.html>

    ## 转码到webm
    * <https://trac.ffmpeg.org/wiki/Encode/VP8>

    ## webcam capture
    * <https://trac.ffmpeg.org/wiki/Capture/Webcam>
    74 changes: 74 additions & 0 deletions ffmpeg_with_mp3_support_macOS.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,74 @@
    ## Install FFmpeg with MP3 support on macOS

    > Instructions for installing the command-line media conversion program FFmpeg with MP3 support on macOS. via GitHubGist user [stevemclaugh](https://gist.github.com/stevemclaugh/aa96cb5d8add3bfded51e0e586179959)
    ## Initial Setup

    If **Homebrew** is already installed, skip to **"Install FFmpeg"** below.

    Launch **`Terminal`** in macOS, located at **`/Applications/Utilities/Terminal.app`**. To install a bundle of command-line tools provided by Apple, paste the following line into the terminal window and press return. When prompted, click "Install," then "Agree."

    ```
    xcode-select --install
    ```

    Run the following command to install the **Homebrew** package manager. Enter your password at the prompt to proceed.

    ```
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    ```

    Next, enter this command to update Homebrew.

    ```
    brew update
    ```

    > If Homebrew returns an error, enter the following command to give it the permissions it expects.
    >
    > `sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local`

    ## Install FFmpeg

    First, run the following command to remove **FFmpeg** in case it's already installed.

    ```
    brew uninstall --force --ignore-dependencies ffmpeg
    ```

    Now let's install the required compilation utilities and media codecs.

    ```
    brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 xvid yasm
    ```

    Next we'll download FFmpeg's source code and compile it before installing. Although it's faster to install FFmpeg through Homebrew, that version can't read or write MP3 files.

    Enter the following commands one at a time; note that the third line is very long. After the last command you will be prompted to enter your admin password.

    ```
    git clone http://source.ffmpeg.org/git/ffmpeg.git ffmpeg
    cd ffmpeg
    ./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid
    make && sudo make install
    ```

    The final step above will take 5 or 10 minutes to complete. When it's done, open a new terminal window and enter the following to view FFmpeg's manual.

    ```
    man ffmpeg
    ```

    If you've made it this far, you should be all set. Press **`q`** to close the manual.

    Here's a basic FFmpeg command to convert a file called **input.wav** on your desktop to a 320Kbps MP3 called **output.mp3**.

    ```
    cd ~/Desktop
    ffmpeg -i input.wav -ab 320k output.mp3
    ```
  2. @windyinsc windyinsc revised this gist Aug 17, 2017. No changes.
  3. @windyinsc windyinsc revised this gist Aug 17, 2017. 1 changed file with 162 additions and 0 deletions.
    162 changes: 162 additions & 0 deletions ffmpeg_common_commands.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,162 @@
    # Common ffmpeg Commands

    > via GitHubGist user [eyecatchup](https://gist.github.com/eyecatchup/51ebf27478889a42e07c2baeedebb76b)
    ### cut sequence from mp4 video

    ```sh
    ffmpeg -ss <start_time_hh:ii:ss> -i input.mp4 -to <length_in_hh:ii:ss_from_start> -c copy ./out.mp4
    ffmpeg -ss 00:47:42 -i input.mp4 -to 00:01:49 -c copy ./out.mp4
    ```

    ---

    ### create thumbnail images from input video (@30fps)

    ```sh
    ffmpeg -i input.mp4 -r 30/1 ./out-%03d.jpg
    ```

    ---

    ### concatinate multiple video files

    ```sh
    ffmpeg -f concat -i filelist.txt -c:v copy ./out.mp4
    ```

    Contents if `filelist.txt`:

    file input1.mp4
    file input2.mp4

    Note: Must call `ffmpeg` in path of `filelist.txt` and use relative paths in `filelist.txt`!

    ---

    ### add blur to video

    **Blur video:**

    ```sh
    ffmpeg -i input.mp4 -vf "boxblur=5:1" ./out.mp4
    ```

    **Add blur overlay to specific area:**

    ```sh
    ffmpeg -i input.mp4 -filter_complex "[0:v]crop=<width_px>:<height_px>:<margin_left_px>:<margin_top_px>,boxblur=<chroma_level_1-9>[fg]; [0:v][fg]overlay=<margin_left_px>:<margin_top_px>[v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy -movflags +faststart ./out.mp4
    ffmpeg -i input.mp4 -filter_complex "[0:v]crop=120:40:60:40,boxblur=9[fg]; [0:v][fg]overlay=60:40[v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy -movflags +faststart ./out.mp4
    ```

    _[More examples (e.g. how to use masks)](https://superuser.com/a/901705)_

    ---

    ### save RMTP video stream to local flv video

    ```sh
    ffmpeg -i rtmp://web1.iptv-planet.com:81/live2/ -y -f flv ./out.flv
    ```

    ---

    ### save M3U8 HTTP video stream to local mp4 video

    ```sh
    ffmpeg -i "http://example.com/playlist.m3u8" -c:v copy -bsf:a aac_adtstoasc ./out.mp4
    ```
    _[Reference for "aac_adtstoasc"][bs_filter_aac_adtstoasc]_

    ---

    ### convert avi video to mp4 video

    **If you have libfaac:**

    ```sh
    # mpeg4 (native) -> mpeg4 (native)
    ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a libfaac -b:a 192k -ac 2 out.mp4
    ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a aac -strict experimental -b:a 192k -ac 2 out.mp4
    ```

    **If you _don't_ have libfaac:**

    ```sh
    # mpeg4 (native) -> mpeg4 (native)
    # mp3 (native) -> aac (native)
    ffmpeg -i input.avi -acodec libfaac -b:a 192k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 ./out.mp4
    ffmpeg -i input.avi -acodec aac -strict experimental -b:a 192k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 ./out.mp4
    ```

    ```sh
    # mpeg4 (native) -> h264 (libx264)
    ffmpeg -i input.avi -c:v libx264 -crf 22 -preset medium -c:a aac -strict experimental -b:a 192k -ac 2 ./out.mp4
    ```

    ```sh
    # mpeg4 (native) -> h264 (libx264)
    # mp3 (native) -> aac (native)
    ffmpeg -i input.avi -c:v libx264 -crf 23 -profile:v high -r 30 -c:a aac -strict experimental -q:a 100 -ar 48000 out.mp4
    ```

    # alternatives: -b:a 128k
    # -b:a 192k
    # -crf 19 -preset slow
    # -crf 22 -preset medium

    ---

    ### convert flv video to mp4 video

    ```sh
    ffmpeg -i input.flv -vcodec copy -acodec copy ./out.mp4

    ffmpeg -i input.flv -c:v copy -bsf:a aac_adtstoasc ./out.mp4
    ```
    _[Reference for "aac_adtstoasc"][bs_filter_aac_adtstoasc]_

    If the error `Could not find tag for codec vp6f in stream #0, codec not currently supported in container` occurs, try:

    ```sh
    ffmpeg -i input.flv -c:v libx264 -crf 23 -preset medium -c:a aac -strict -2 -b:a 128k -ar 44100 -ac 2 ./out.mp4
    ```

    ---

    ### convert wmv video to mp4 video

    ```sh
    ffmpeg -i file.wmv -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -preset medium -crf 22 -movflags +faststart ./out.mp4

    ffmpeg -i input.wmv -c:v libx264 -crf 23 -preset medium ./out.mp4

    ffmpeg -i input.wmv -c:v libx264 -crf 23 -c:a libfaac -q:a 100 ./out.mp4

    ffmpeg -i input.wmv -c:v libx264 -crf 23 -profile:v high -r 30 -c:a libfaac -q:a 100 -ar 48000 ./out.mp4

    ffmpeg -i input.wmv -c:v libx264 -crf 23 -profile:v high -r 30 -c:a aac -strict experimental -q:a 100 -ar 48000 ./out.mp4
    ```

    ---

    ### Legend + References

    ##### Special FAAC switches & bitstream filters

    [FAAC](http://www.audiocoding.com/faac.html) is an MPEG-4 and MPEG-2 AAC encoder.

    - **[`-flag`][faac_flag]**
    The flag command is used to by calling "-flag", followed by a single space and then all flags with a plus "+" or minus "-" sign preceding each indicating active or inactive flag respectively.
    - **[`+aic`][faac_flag_aic]**
    h263 advanced intra coding / mpeg4 ac prediction (Affects: Encoding, Video)
    - **[`+mv4`][faac_flag_mv4]**
    Use four motion vector by macroblock (mpeg4) (Affects: Encoding, Video)
    - **[`-bsf:a aac_adtstoasc`][bs_filter_aac_adtstoasc]**
    Convert MPEG-2/4 AAC ADTS to an MPEG-4 Audio Specific Configuration bitstream. Is required for example when copying an AAC stream from a raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV file, or to MOV/MP4 files and related formats such as 3GP or M4A.


    [faac_flag]: https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/Flags_Flags
    [faac_flag_aic]: https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/Flags_Flags#aic
    [faac_flag_mv4]: https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/Flags_Flags#mv4
    [bs_filter_aac_adtstoasc]: https://ffmpeg.org/ffmpeg-bitstream-filters.html#aac_005fadtstoasc
  4. @larvata larvata revised this gist Jul 16, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,11 @@ ref: http://forum.videohelp.com/threads/343902-Looking-for-ts-to-mp4-conversion-
    ffmpeg [-protocol_whitelist "file,http,https,tcp,tls"] -i <source.m3u8> -c copy <target.ts>
    ```

    Or just use:
    ```
    ffmpeg -protocol_whitelist "file,http,tcp,https,tls,crypto" -i <source.m3u8> -c copy <target.ts>
    ```

    ### Convert Video to GIF
    ref: http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
    ```
  5. @larvata larvata revised this gist Jun 13, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ ref: http://forum.videohelp.com/threads/343902-Looking-for-ts-to-mp4-conversion-
    # step 1: download m3u8 and key file
    # step 2: modify key file path in m3u8 file
    # step 3: download m3u8
    ffmpeg -i <source.m3u8> -c copy <target.ts>
    ffmpeg [-protocol_whitelist "file,http,https,tcp,tls"] -i <source.m3u8> -c copy <target.ts>
    ```

    ### Convert Video to GIF
    @@ -52,5 +52,5 @@ ffmpeg -i <input.mp4> <out.mp3>
    ### Burn Subtitles into Video
    ref: https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo
    ```
    ffmpeg -i video.avi -vf "ass=subtitle.ass" out.avi
    ffmpeg -i video.avi -vf "yadif, ass=subtitle.ass" out.avi
    ```
  6. @larvata larvata revised this gist Feb 19, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,7 @@ ffmpeg -f concat -i ts.lst -c copy all.ts

    ### Convert TS to MP4
    ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html

    `ffmpeg -i <source.ts> -c copy -bsf:a aac_adtstoasc <target.mp4>`

    ### Download Online AES-128 Encrypted HLS Video
  7. @larvata larvata revised this gist Feb 19, 2017. 1 changed file with 13 additions and 3 deletions.
    16 changes: 13 additions & 3 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,26 @@
    # ffmpeg Cheatsheet

    - Join TS Files
    - Convert TS to MP4
    - Download Online AES-128 Encrypted HLS video
    - Convert Video to GIF
    - Extract Audio and Convert it to MP3
    - Burn Subtitles into Video

    ### Join TS Files
    ref: http://superuser.com/questions/692990/use-ffmpeg-copy-codec-to-combine-ts-files-into-a-single-mp4
    ```
    # create ts filelist as following format:
    file '<filepath>'
    # or use following command to generate:
    (for %i in (*.ts) do @echo file '%i') > ts.lst
    # concat the ts files by ffmpeg
    ffmpeg -f concat -i ts.lst -c copy all.ts
    ```

    ### Convert TS to MP4
    ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html

    `ffmpeg -i <source.ts> -c copy -bsf:a aac_adtstoasc <target.mp4>`

    ### Download Online AES-128 Encrypted HLS Video
    @@ -29,15 +41,13 @@ ffmpeg -i <input.mp4> -vf scale=320:-1 -r 10 frames/ffout%03d.png
    # merge frames to gif
    convert -delay 5 -loop 0 [-crop '100%x56%'] frames/ffout*.png <output.gif
    ```

    ### Extract Audio and Convert it to MP3
    ```
    ffmpeg -i <input.mp4> <out.mp3>
    ```


    ### Burn Subtitles into Video
    ref: https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo
    ```
  8. @larvata larvata revised this gist Jan 31, 2017. 1 changed file with 16 additions and 11 deletions.
    27 changes: 16 additions & 11 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,17 @@
    # ffmpeg Cheatsheet

    - Convert ts to mp4
    - Download online AES-128 encrypted HLS video
    - Convert video to gif
    - Extract audio and convert to mp3
    - Convert TS to MP4
    - Download Online AES-128 Encrypted HLS video
    - Convert Video to GIF
    - Extract Audio and Convert it to MP3
    - Burn Subtitles into Video

    ### Convert ts to mp4
    ### Convert TS to MP4
    ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html

    `ffmpeg -i <source.ts> -c copy -bsf:a aac_adtstoasc <target.mp4>`

    ### Download online AES-128 encrypted HLS video
    ### Download Online AES-128 Encrypted HLS Video
    ref: http://forum.videohelp.com/threads/343902-Looking-for-ts-to-mp4-conversion-tool
    ```
    # step 1: download m3u8 and key file
    @@ -19,7 +20,7 @@ ref: http://forum.videohelp.com/threads/343902-Looking-for-ts-to-mp4-conversion-
    ffmpeg -i <source.m3u8> -c copy <target.ts>
    ```

    ### Convert video to gif
    ### Convert Video to GIF
    ref: http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
    ```
    # extract frames from video
    @@ -31,10 +32,14 @@ convert -delay 5 -loop 0 [-crop '100%x56%'] frames/ffout*.png <output.gif
    ```

    ### Extract audio and convert to mp3
    `ffmpeg -i <input.mp4> <out.mp3>`
    ### Extract Audio and Convert it to MP3
    ```
    ffmpeg -i <input.mp4> <out.mp3>
    ```


    ### Burn Subtitles Into Video
    ### Burn Subtitles into Video
    ref: https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo
    `ffmpeg -i video.avi -vf "ass=subtitle.ass" out.avi`
    ```
    ffmpeg -i video.avi -vf "ass=subtitle.ass" out.avi
    ```
  9. @larvata larvata revised this gist Dec 14, 2016. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -33,3 +33,8 @@ convert -delay 5 -loop 0 [-crop '100%x56%'] frames/ffout*.png <output.gif

    ### Extract audio and convert to mp3
    `ffmpeg -i <input.mp4> <out.mp3>`


    ### Burn Subtitles Into Video
    ref: https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo
    `ffmpeg -i video.avi -vf "ass=subtitle.ass" out.avi`
  10. @larvata larvata revised this gist Jul 26, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,8 @@ mkdir frames
    ffmpeg -i <input.mp4> -vf scale=320:-1 -r 10 frames/ffout%03d.png
    # merge frames to gif
    convert -delay 5 -loop 0 frames/ffout*.png <output.gif>
    convert -delay 5 -loop 0 [-crop '100%x56%'] frames/ffout*.png <output.gif
    ```

    ### Extract audio and convert to mp3
  11. @larvata larvata revised this gist May 25, 2016. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,34 @@
    # ffmpeg Cheatsheet

    - Convert ts to mp4
    - Download online AES-128 encrypted HLS video
    - Convert video to gif
    - Extract audio and convert to mp3

    ### Convert ts to mp4
    ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html

    `ffmpeg -i source.ts -c copy -bsf:a aac_adtstoasc target.mp4`
    `ffmpeg -i <source.ts> -c copy -bsf:a aac_adtstoasc <target.mp4>`

    ### Download online AES-128 encrypted HLS video
    ref: http://forum.videohelp.com/threads/343902-Looking-for-ts-to-mp4-conversion-tool
    ```
    # step 1: download m3u8 and key file
    # step 2: modify key file path in m3u8 file
    # step 3: download m3u8
    ffmpeg -i source.m3u8 -c copy target.ts
    ffmpeg -i <source.m3u8> -c copy <target.ts>
    ```

    ### Convert video to gif
    ref: http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
    ```
    # extract frames from video
    mkdir frames
    ffmpeg -i input -vf scale=320:-1 -r 10 frames/ffout%03d.png
    ffmpeg -i <input.mp4> -vf scale=320:-1 -r 10 frames/ffout%03d.png
    # merge frames to gif
    convert -delay 5 -loop 0 frames/ffout*.png output.gif
    convert -delay 5 -loop 0 frames/ffout*.png <output.gif>
    ```

    ### Extract audio and convert to mp3
    `ffmpeg -i <input.mp4> <out.mp3>`
  12. @larvata larvata revised this gist May 21, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # ffmpeg cheatsheet
    # ffmpeg Cheatsheet

    ### Convert ts to mp4
    ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html
  13. @larvata larvata revised this gist May 21, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ ffmpeg -i source.m3u8 -c copy target.ts
    ```

    ### Convert video to gif
    reference http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
    ref: http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
    ```
    # extract frames from video
    mkdir frames
  14. @larvata larvata revised this gist May 21, 2016. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -16,10 +16,6 @@ ffmpeg -i source.m3u8 -c copy target.ts

    ### Convert video to gif
    reference http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality

    start_time: -ss 00:00:00.000

    duration: -t 00:00:10.000
    ```
    # extract frames from video
    mkdir frames
  15. @larvata larvata revised this gist May 21, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,9 @@ ffmpeg -i source.m3u8 -c copy target.ts

    ### Convert video to gif
    reference http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality

    start_time: -ss 00:00:00.000

    duration: -t 00:00:10.000
    ```
    # extract frames from video
  16. @larvata larvata revised this gist May 21, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,9 @@ ffmpeg -i source.m3u8 -c copy target.ts
    ```

    ### Convert video to gif
    # reference http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
    # start_time: -ss 00:00:00.000
    # duration: -t 00:00:10.000
    reference http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
    start_time: -ss 00:00:00.000
    duration: -t 00:00:10.000
    ```
    # extract frames from video
    mkdir frames
  17. @larvata larvata revised this gist May 21, 2016. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -13,3 +13,16 @@ ref: http://forum.videohelp.com/threads/343902-Looking-for-ts-to-mp4-conversion-
    # step 3: download m3u8
    ffmpeg -i source.m3u8 -c copy target.ts
    ```

    ### Convert video to gif
    # reference http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
    # start_time: -ss 00:00:00.000
    # duration: -t 00:00:10.000
    ```
    # extract frames from video
    mkdir frames
    ffmpeg -i input -vf scale=320:-1 -r 10 frames/ffout%03d.png
    # merge frames to gif
    convert -delay 5 -loop 0 frames/ffout*.png output.gif
    ```
  18. @larvata larvata revised this gist May 21, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,15 @@
    # ffmpeg cheatsheet

    ## convert ts to mp4
    ### Convert ts to mp4
    ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html

    `ffmpeg -i source.ts -c copy -bsf:a aac_adtstoasc target.mp4`

    ## download online AES-128 encrypted HLS video
    ### Download online AES-128 encrypted HLS video
    ref: http://forum.videohelp.com/threads/343902-Looking-for-ts-to-mp4-conversion-tool
    ```
    # step 1: download m3u8 and key file
    # step 2: modify key file path in m3u8 file
    # step 3: download m3u8
    ffmpeg -i source.m3u8 -c copy target.ts
    ```
    ```
  19. @larvata larvata revised this gist May 21, 2016. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,14 @@

    ## convert ts to mp4
    ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html
    `ffmpeg -i source.ts -c copy -bsf:a aac_adtstoasc target.mp4`

    `ffmpeg -i source.ts -c copy -bsf:a aac_adtstoasc target.mp4`

    ## download online AES-128 encrypted HLS video
    ref: http://forum.videohelp.com/threads/343902-Looking-for-ts-to-mp4-conversion-tool
    ```
    # step 1: download m3u8 and key file
    # step 2: modify key file path in m3u8 file
    # step 3: download m3u8
    ffmpeg -i source.m3u8 -c copy target.ts
    ```
  20. @larvata larvata revised this gist May 21, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # ffmpeg cheatsheet

    ## convert ts to mp4
    # ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html
    ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html
    `ffmpeg -i source.ts -c copy -bsf:a aac_adtstoasc target.mp4`
  21. @larvata larvata revised this gist May 21, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # convert ts to mp4
    # ffmpeg cheatsheet

    ## convert ts to mp4
    # ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html
    `ffmpeg -i source.ts -c copy -bsf:a aac_adtstoasc target.mp4`
  22. @larvata larvata created this gist May 21, 2016.
    3 changes: 3 additions & 0 deletions ffmpeg-cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # convert ts to mp4
    # ref: https://ffmpeg.org/ffmpeg-bitstream-filters.html
    `ffmpeg -i source.ts -c copy -bsf:a aac_adtstoasc target.mp4`