group the octal digits in groups of 4: $\{O_1,O_2,O_3,O_4\}$ prepending $0$ as needed
then the first hex digit is $O_1*2+\lfloor \frac{O_2}{4}\rfloor$
the second is $O_2*4+\lfloor \frac{O_3}{2}\rfloor \mod 16$
then the last digit is $O_3*8+O_4 \mod 16$
I make use of the fact that $8^4=16^3$ so each group of 4 octal digits maps 1-1 to 3 hex digits.
to use the example of $347_8$ from the other answers my digits are $\{0,3,4,7\}$
the first hex digit is $0*2+\lfloor \frac{3}{4}\rfloor=0$
the second is $3*4+\lfloor \frac{4}{2}\rfloor \mod 16=12+2=14=E_{16}$
the third digit is $4*8+7 \mod 16=32+7\mod16=7$
so the result is $\text{0E7}_{16}$