[FFmpeg-user] ffmpeg hwmap SW decoded frame to OpenCL and hwmap back to h264 for SW encode

Ted Park kumowoon1025 at gmail.com
Tue Nov 5 11:04:48 EET 2019


>  But got error: "Segmentation fault: 11", so may be I'm doing something wrong?

Yeah a segfault should make you take a step back and look at what your doing for sure.

> I trying speed up process and avoid copy frames between GPU and CPU.

Probably the only way to do this is to get rid of all the hw acceleration in your command, it’s gotta be converted at some point right?
Actually is “HD Graphics 4000” an intel or ati card, is it just me that feels like it could be either

But anyhow, 

> ./ffmpeg -i ../720.mp4 ...

That isn't going to decode in hardware. And idk without trace, but I’m guessing the kernel did not like it at all when you rw mapped the decoded frames and something else (seemingly out of the blue random for all it knows) started messing with it, and it said no you can’t do that. Even if it is integrated graphics and shares main memory, I’d think the filter would be a separate process and it’d be considered “not safe"

> Matched encoder 'libx264' for codec 'h264'.
> [file @ 0x7fbb1ec44680] Setting default whitelist 'file,crypto'
> Successfully opened the file.
> detected 8 logical cores
> [h264 @ 0x7fbb1f9a9800] nal_unit_type: 7(SPS), nal_ref_idc: 1
> [h264 @ 0x7fbb1f9a9800] nal_unit_type: 8(PPS), nal_ref_idc: 1
> Stream mapping:
>   Stream #0:0 (h264) -> hwmap
>   hwmap -> Stream #0:0 (libx264)

…

> [graph 0 input from stream 0:0 @ 0x7fbb1ee09040] w:1280 h:720 pixfmt:yuv420p tb:1/30000 fr:30000/1001 sar:1/1 sws_param:flags=2
> [format @ 0x7fbb1ed0a080] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21|yuv420p10le|yuv422p10le|yuv444p10le|nv20le'
> [AVFilterGraph @ 0x7fbb21004240] query_formats: 7 queried, 6 merged, 0 already done, 0 delayed
> [Parsed_hwmap_2 @ 0x7fbb1ed03e00] picking yuv420p out of 13 ref:opencl alpha:1
> [Parsed_hwmap_0 @ 0x7fbb1ed09940] Configure hwmap yuv420p -> opencl.
> [Parsed_hwmap_2 @ 0x7fbb1ed03e00] Configure hwmap opencl -> yuv420p.


And in the end x264 does the encode so I feel like it would actually be faster without OpenCL? Or if that’s an Intel integrated gpu is quick sync an option? I am curious because I don’t know how to build ffmpeg with OpenCL, I’ve tried, but on the newer versions of macOS, it’s getting harder to use gpus for compute other than with cocoa avfoundation or “metal"



More information about the ffmpeg-user mailing list