Solved:
Like LordNeckbeard said, option placement matters in ffmpeg.
Basic order is:
ffmpeg [global options] [input options] -i input [output options] output
I changed to the command below (putting -g 30 -bf 2) and it works:
ffmpeg -s cif -r 30 -i video.yuv -vcodec mpeg4 -g 30 -bf 2 video.m4v
Note: Even after changed in the first time did not worked. The program asked me to overwrite the files and I said Yes. But apparently sth was not removed, at the moment I removed all files and did it again (from zero) it worked.
Now the result is:
[robert@10-2Fontes]$ head -n 40 trace
1 H 12038 9 0.034
2 P 13204 10 0.132
3 B 5367 4 0.132
4 B 5553 4 0.132
5 P 12157 9 0.232
6 B 5069 4 0.232
7 B 5613 4 0.232
8 P 12739 9 0.334
9 B 5935 5 0.334
10 B 3921 3 0.334
11 P 4474 4 0.429
12 B 1247 1 0.429
13 B 784 1 0.429
14 P 1448 1 0.528
15 B 350 1 0.528
16 B 397 1 0.528
17 P 1023 1 0.627
18 B 299 1 0.633
19 B 265 1 0.634
20 P 829 1 0.727
21 B 209 1 0.733
22 B 340 1 0.733
23 P 867 1 0.826
24 B 343 1 0.833
25 B 378 1 0.833
26 P 865 1 0.925
27 B 282 1 0.925
28 B 461 1 0.925
29 H 5083 4 1.034
30 B 818 1 1.034
31 B 838 1 1.034
32 P 1171 1 1.122
33 B 443 1 1.133
34 B 409 1 1.133
35 P 1078 1 1.221
36 B 269 1 1.233
37 B 327 1 1.233
38 P 795 1 1.321
39 B 298 1 1.333
40 B 304 1 1.334
41 P 854 1 1.419
42 B 477 1 1.419
43 B 412 1 1.419
44 P 869 1 1.519
45 B 371 1 1.519
46 B 314 1 1.519
47 P 983 1 1.617
48 B 337 1 1.617
49 B 454 1 1.617
50 P 1118 1 1.717
51 B 286 1 1.717
52 B 275 1 1.717
53 P 1044 1 1.815
54 B 362 1 1.815
55 B 273 1 1.815
56 P 973 1 1.914
57 B 302 1 1.914
58 B 324 1 1.915
59 H 4525 4 2.033