пятница, 13 февраля 2015 г.

8. Add an empty sound in an audio stream

for sequence:
ffmpeg -f lavfi -i aevalsrc=0 -i 30fps/blend4web%*.png -r 30 -c:v libx264 -preset veryslow -t 9 -map 0:0 -map 1:0 -shortest -y intro.mkv

for video:
ffmpeg -f lavfi -i aevalsrc=0 -i input.mp4 -vcodec copy -acodec aac -map 0:0 -map 1:0 -shortest -strict experimental -y out.mp4

вторник, 10 февраля 2015 г.

7. concat

ffmpeg -i intro.mkv -i test.mkv \
-filter_complex '[0:a] [1:a] concat=n=2:v=0:a=1 [a] ;
[0:v] fade=out:s=200:n=50:d=0.999 [fout] ;
[1:v] fade=in:s=20:n=10:d=0.9 [fin] ;
[fout] [fin] concat=n=2:v=1:a=0 [v]' -map '[v]' -map '[a]' -y output.mkv


And cycle:

path_in="/home/mikhail/smb/cg_event_2014/cgevent2014_video2/old/"
path_to="/home/mikhail/Desktop/video/cgevent_masterclass/"

for a in "$path_in"*.mp4 ; do

b=${a##*/}

    ffmpeg -i $a -c copy "$path_to"/${b%%.*}.mkv

    ffmpeg -i "/media/sdb1TB/mikhail/works/video/footage/blend4web_end/intro.mkv" -i "$path_to"${b%%.*}.mkv \
    -filter_complex '[0:a] [1:a] concat=n=2:v=0:a=1 [a] ;
    [0:v] fade=out:s=180:n=50:d=0.999 [fout] ;
    [1:v] fade=in:s=20:n=10:d=0.9 [fin] ;
    [fout] [fin] concat=n=2:v=1:a=0 [v]' -map '[v]' -map '[a]' -y -b:v 10M -b:a 192k "$path_to"out/${b%%.*}.mkv

#echo $b

done

exec bash


6. ffprobe

ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"

5. Video to gif imagemagick(linux)

ffmpeg -ss 00:00:06.500 -i "yesbuddy.mp4" -vf: "crop=1000:1000" -s 512x512 -r 2 -t 00:00:22 out/output_%03d.png
convert -delay 15 -loop 0 out/*.png output.gif #"15"ms for frame?

convert -layers OptimizeTransparency output.gif anim_optimized.gif

4. screencast (windows)

Download:
screen-capture-recorder-to-video-windows-free (screencapturer)
Install
View devices:
ffmpeg -list_devices true -f dshow -i dummy
Screencast:
ffmpeg -f dshow -r 10 -i audio="virtual-audio-capturer"­:audio="Микрофон (Cirrus Logic CS4206B ":video="screen-capture-record­er" -vcodec h264 -b:v 5000k -acodec aac -strict experimental -ac 2 -b:a 320k -vf "scale=-1:1080" -y out.mp4

3. video to crop sequence and sound cycles (linux)

#!/bin/bash
for a in *.mp4
do
#cd ./sequence3
mkdir ./sequence3/${a%.mp4}

ffmpeg -i "$a" -vf: "crop=1920:1080:100:24" -threads 8 -r 30 -qscale:v 2 sequence3/${a%.mp4}/${a%.mp4}_%05d.png
ffmpeg -i "$a" -threads 8 -vn -ar 44100 -ac 2 -ab 194k -f mp3 sequence3/${a%.mp4}/${a%.mp4}.mp3

done

2. video to crop sequence and sound

ffmpeg -i "in.mp4" -threads 8 -vf: "crop=1920:1080:100:24" -r 30 -f image2 out/out%05d.png

ffmpeg -i "in.mp4" -threads 8 -vn -ar 44100 -ac 2 -ab 384k -f mp3 out.mp3