ffmpeg drawtext filter - create transparent background with text
Use drawbox for the box, and drawtext for the text.



ffmpeg -i input.mp4 -vf \
"format=yuv444p, \
 drawbox=y=ih/PHI:color=black@0.4:width=iw:height=48:t=fill, \
 drawtext=fontfile=OpenSans-Regular.ttf:text='Title of this Video':fontcolor=white:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, \
 format=yuv420p" \
-c:v libx264 -c:a copy -movflags +faststart output.mp4



drawtext has a box option, but as far as I can tell it can't be an arbitrary width and is relative to the text size, so that is why drawbox is used instead.
The format filter is used to improve the color of the drawbox area; otherwise, depending on your input and output formats, the area could look de-saturated or monochrome. The format filter is then used again to ensure that the pixel format of the output file is compatible with all players.
The audio is being stream copied in this example because you may not want to needlessly re-encode it.
Old ffmpeg users will have to use t=max instead of t=fill.