pytorch 1.12.1 doesn't build with ffmpeg 5.0
Labels: module: build, triaged

### 🐛 Describe the bug

I am trying to create a Yocto recipe for Pytorch and the build fails with these errors
```
[yocto@ip-192-168-1-213 temp]$ grep 'error:' log.do_compile.3444492 
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:15:5: error: 'av_register_all' was not declared in this scope
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:16:5: error: 'avcodec_register_all' was not declared in this scope
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:30:17: error: 'avcodec_decode_audio4' was not declared in this scope; did you mean 'avcodec_decode_subtitle2'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:188:21: error: 'struct AVStream' has no member named 'codec'
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:193:21: error: 'struct AVStream' has no member named 'codec'
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:210:40: error: 'AVStream' {aka 'struct AVStream'} has no member named 'codec'
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:229:70: error: 'AVStream' {aka 'struct AVStream'} has no member named 'codec'
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:455:13: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:460:13: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:486:13: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:491:15: error: 'avcodec_decode_video2' was not declared in this scope; did you mean 'avcodec_decode_subtitle2'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:500:13: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:506:15: error: 'av_frame_get_best_effort_timestamp' was not declared in this scope
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:537:17: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:563:17: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:574:15: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:586:30: error: 'avpicture_get_size' was not declared in this scope
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:591:20: error: 'AVPicture' was not declared in this scope; did you mean 'gotPicture'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:591:30: error: expected primary-expression before ')' token
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:590:26: error: 'avpicture_fill' was not declared in this scope
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:631:9: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
/data/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/libtorch/1.12.1-r0/git/caffe2/video/video_decoder.cc:633:9: error: 'av_free_packet' was not declared in this scope; did you mean 'av_new_packet'?
```
Yocto 4.0 Kirkstone, FFMPEG 5.0.x

### Versions

Yocto is a cross-compiler environment and `collect_env.py` script collects data from the build host, which definitely doesn't match what Yocto uses. But here it is:
```
[yocto@ip-192-168-1-213 git]$ python collect_env.py
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Fedora 33 (Cloud Edition) (x86_64)
GCC version: (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1)
Clang version: 11.0.0 (Fedora 11.0.0-3.fc33)
CMake version: Could not collect
Libc version: glibc-2.32

Python version: 3.9.9 (main, Nov 19 2021, 00:00:00)  [GCC 10.3.1 20210422 (Red Hat 10.3.1-1)] (64-bit runtime)
Python platform: Linux-5.14.17-101.fc33.x86_64-x86_64-with-glibc2.32
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

Versions of relevant libraries:
[pip3] No relevant packages
[conda] Could not collect
```

cc @malfet @seemethere