According to ffmpeg manual, setting -g
is to define space between "I" frames, and setting -bf
to use "B" frames. The former I got, but the latter not.
The goal: I'm trying to have a video with a GOP 3,12 (M= 3, N=12). That means: 2 "B" frames separating each "P" frames, and "I" frames with 12 frames of distance. Or simply: "IBBPBBPBBPBBI"
I think that I got only the N=12, using the commands below:
ffmpeg -s cif -r 30 -b 64000 -bt 3200 -g 12 -y -i video.yuv -vcodec mpeg4 video.m4v
MP4Box -hint -mtu 1460 -fps 30 -add video.m4v video.mp4
ffmpeg -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 > trace
head -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
*Note, the most important is the command -g 12
in ffmpeg, but I writing all the commands. The video that I'm using is the "highway", from cif page videos: http://www2.tkn.tu-berlin.de/research/evalvid/cif.html
I don't know why the result trace is using "H" instead of "I".
I tried to put -bf 2
in ffmpeg command, but did not worked (I think because I saw no "B" indications in the result)
List item
ffmpeg -s cif -r 30 -b 64000 -bt 3200 -g 12 -bf 2 -y -i video.yuv -vcodec mpeg4 video.m4v
Result:
[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
ffmpeg [global options] [input options] -i input [output options] output
– Override