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:
- Encode a video with h264_videotoolbox
$ ffmpeg -i input.foo -acodec copy -vcodec h264_videotoolbox -b:v 20000k -profile:v main /ffmpeg_output.mp4
- 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)
Change History (9)
by , 5 years ago
Attachment: | outputfile.txt.zip added |
---|
comment:2 by , 5 years ago
HandBrake uses a patch to fix this
https://github.com/HandBrake/HandBrake/blob/master/contrib/ffmpeg/A04-videotoolbox.patch
follow-up: 4 comment:3 by , 5 years ago
Status: | new → open |
---|
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).
follow-up: 5 comment:4 by , 5 years ago
Thanks, I will try to make a commit according to your suggestions.
comment:5 by , 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 , 5 years ago
Keywords: | videotoolbox added |
---|
comment:7 by , 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 , 5 years ago
Resolution: | → worksforme |
---|---|
Status: | open → closed |
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.
Full output