Intel GPU及NVIDIA GPU对视频编解码支持情况

 编解码可以软编实现(CPU),或者硬编(GPU),当然还可以使用专用的编解码卡(IC),他们各有优点,但是基于硬件的处理往往速度更快。但是也有人说软编有更大的可调节性。这里我们只记录硬编的硬件支持情况,尤其是软编效率没有上来的情况下这显得尤其重要。

废话不多说,先上intel GPU QSV硬编解情况:

摘自:https://en.wikipedia.org/wiki/Intel_Quick_Sync_Video#Hardware_decoding_and_encoding

ffmpeg qsv使用方法:https://trac.ffmpeg.org/ticket/5899

重点:

CQ:

./ffmpeg_g -y -i in.mp4 -an -c:v hevc_qsv -load_plugin hevc_hw -q 30 out.mp4

CBR:

./ffmpeg_g -y -i in.mp4 -an -c:v hevc_qsv -load_plugin hevc_hw -b 5M -maxrate 5M out.mp4

注意:hevc_qsv只输出IB帧,无P帧。我反复尝试了N次后依然如此,尤其是其中有个-r 1(no B frames)给人无B帧的希望

。有段Intel人员给的解释如下:

 Sorry for a delayed response. Media SDK HW HEVC encoder uses Low Delay B-frames (LDB) or Generalized P/B (GPB) instead of P-frames. So, instead of encode P-frame with L0, Media SDK encodes LDB or GPB with the same L0 and L1. That's why you see just such LDB or GPB frame where both the L0 and L1 lists have the same I frame for reference and no P-frames. 
出处:https://software.intel.com/en-us/forums/intel-media-sdk/topic/623600

nvidia nvenc:


摘自:https://developer.nvidia.com/nvidia-video-codec-sdk#NVENCFeatures

https://developer.nvidia.com/video-encode-decode-gpu-support-matrix#Encoder

  • 2
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
首先,您需要安装适用于您的GPUNVIDIA CUDA和cuDNN库。然后,您可以使用深度学习框架(如TensorFlow、PyTorch等)来编写您的Python程序,并将其配置为在GPU上运行。以下是一些步骤: 1. 安装CUDA和cuDNN库,确保您的GPU与这些库兼容。 2. 安装深度学习框架,例如TensorFlow或PyTorch。请确保您安装的版本与您的CUDA和cuDNN版本兼容。 3. 在您的Python程序中,导入相应的深度学习框架库。 4. 创建一个包含所需计算的模型,并将其放置在GPU上。例如,使用TensorFlow: ``` import tensorflow as tf # 创建模型 model = tf.keras.models.Sequential([ tf.keras.layers.Dense(10, activation='relu', input_shape=(784,)), tf.keras.layers.Dense(10, activation='softmax') ]) # 将模型放置在GPU上 model = tf.keras.utils.multi_gpu_model(model, gpus=2) ``` 5. 编写您的训练循环,并使用GPU进行模型训练和预测。例如,使用TensorFlow: ``` import tensorflow as tf # 创建模型 model = ... # 编译模型 model.compile(optimizer=tf.train.AdamOptimizer(0.001), loss='categorical_crossentropy', metrics=['accuracy']) # 将数据集加载到内存中 (x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() x_train = x_train.reshape(60000, 784).astype('float32') / 255 x_test = x_test.reshape(10000, 784).astype('float32') / 255 y_train = tf.keras.utils.to_categorical(y_train, 10) y_test = tf.keras.utils.to_categorical(y_test, 10) # 在GPU上训练模型 with tf.device('/gpu:0'): model.fit(x_train, y_train, batch_size=128, epochs=20, validation_data=(x_test, y_test)) ``` 这样,您的Python程序就可以在GPU上运行,加速计算。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值