According to the ffmpeg manual, the installation -gconsists of defining a space between frames “I” and setting -bfto use frames “B”. The first thing I got, but the last not.
Purpose: I am trying to get a video with GOP 3.12 (M = 3, N = 12). This means: 2 frames of "B" separating each "P" frame, and "I" frames with 12 frames of distance. Or simply: "IBBPBBPBBPBBI"
I think I only got N = 12 using the following commands:
ffmpeg -s cif -r 30 -b 64000 -bt 3200 -g 12 -y -i video.yuv -vcodec mpeg4 video.m4vMP4Box -hint -mtu 1460 -fps 30 -add video.m4v video.mp4ffmpeg -y -i video.mp4 video_ref.yuv../cmd/psnr 352 288 420 video.yuv video_ref.yuv > psnr_ref.txt../cmd/mp4trace -f -s 192.168.0.2 12346 video.mp4 > tracehead -n 20 trace
Result:
[robert@10-2Fontes]$ head -n 20 trace
1 H 12002 9 0.000
2 P 11479 8 0.034
3 P 12021 9 0.066
4 P 11239 8 0.099
5 P 5407 4 0.134
6 P 2735 2 0.166
7 P 1014 1 0.199
8 P 850 1 0.232
9 P 619 1 0.265
10 P 979 1 0.298
11 P 813 1 0.331
12 P 806 1 0.364
13 H 5109 4 0.396
* , -g 12 ffmpeg, . , , - "", cif: http://www2.tkn.tu-berlin.de/research/evalvid/cif.html
, "H" "I" .
-bf 2 ffmpeg, (, "B" )
ffmpeg -s cif -r 30 -b 64000 -bt 3200 -g 12 -bf 2 -y -i video.yuv -vcodec mpeg4 video.m4v
:
[robert@10-2Fontes]$ head -n 20 trace
1 H 12002 9 0.001
2 P 11479 8 0.034
3 P 12021 9 0.067
4 P 11239 8 0.100
5 P 5407 4 0.132
6 P 2735 2 0.166
7 P 1014 1 0.199
8 P 850 1 0.232
9 P 619 1 0.265
10 P 979 1 0.298
11 P 813 1 0.331
12 P 806 1 0.363
13 H 5109 4 0.400