Opened 5 years ago

Closed 5 years ago

#8353 closed defect (worksforme)

videotoolboxenc: h264_videotoolbox is not writing b-frames

Reported by: Nomis101 Owned by:
Priority: normal Component: avcodec
Version: unspecified Keywords: videotoolbox
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

hevc_videotoolbox does write b-frames, but h264_videotoolbox does not.

Steps:

  1. Encode a video with h264_videotoolbox

$ ffmpeg -i input.foo -acodec copy -vcodec h264_videotoolbox -b:v 20000k -profile:v main /ffmpeg_output.mp4

  1. check the video for b-frames

$ ffprobe -show_frames ffmpeg_output.mp4 > outputfile.txt

In outputfile.txt there is pict_type=P and pict_type=I only, there is no pict_type=B

Full output is attached.

Attachments (1)

outputfile.txt.zip (98.9 KB ) - added by Nomis101 5 years ago.
Full output

Download all attachments as: .zip

Change History (9)

by Nomis101, 5 years ago

Attachment: outputfile.txt.zip added

Full output

comment:1 by Balling, 5 years ago

Really?

comment:3 by Balling, 5 years ago

Status: newopen

Was partially applied here 5e0a3278bb7385f9fee158ccd69b07bf76a9e5df and you need to add

vtctx->has_b_frames = avctx->max_b_frames > 0;

after https://github.com/FFmpeg/FFmpeg/blob/55755b4ab27a94bfa1d91e494441dc2168164d19/libavcodec/videotoolboxenc.c#L1357 in else (this and only this is the real fix, I suppose).

Last edited 5 years ago by Balling (previous) (diff)

in reply to:  3 ; comment:4 by Nomis101, 5 years ago

Thanks, I will try to make a commit according to your suggestions.

in reply to:  4 comment:5 by Balling, 5 years ago

Replying to Nomis101:

Thanks, I will try to make a commit according to your suggestions.

On the second thought dunno how it will fix the issue, after all it is in else of if check for AV_CODEC_ID_H264... heh.

But still please submit it...

comment:6 by Carl Eugen Hoyos, 5 years ago

Keywords: videotoolbox added

comment:7 by Balling, 5 years ago

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200229013951.7792-1-Nomis101@web.de/ maybe you will review it? Though it does not look like it will solve the issue.

comment:8 by Rick Kern, 5 years ago

Resolution: worksforme
Status: openclosed

Use the -bf parameter to something non-zero to enable B-frames for H.264. If the hardware doesn't support B-frames however, they won't be written.

Note: See TracTickets for help on using tickets.