20230403 Call NVIDIA's hardware-accelerated wmv video transcoding to MP4 format through ffmpeg under WIN10

20230403 Call NVIDIA's hardware-accelerated wmv video transcoding to MP4 format through ffmpeg under WIN10
2023/4/3 15:50


I recently learned Japanese, and most of the videos I found in Japanese pronunciation are in MP4 format, and a few are in WMV format. PR2023 does not seem to recognize WMV format.
So: the almighty ffmpeg is here!

 


Manually specify the codec
Check the codec of vc1 through ffmpeg -codecs | findstr "vc1"
You can see that there are vc1_qsv dedicated to i card and vc1_cuivid decoder dedicated to N card

Add the parameter -c:v to specify the decoder: ffmpeg -c:v vc1_cuvid -i input2.wmv -c:v h264_nvenc output.mp4 (choose the corresponding codec according to your graphics card, I am an N card here, so I chose vc1_cuvid as decoder, h264_nvenc as encoder)

It can be seen that the transcoding speed is very fast, and the hardware codec is also fully utilized, and the CPU usage is also low.


Also note that the default encoding output of nvenc is 2000k bit rate, you can manually set the bit rate to reduce the loss of image quality.


ffmpeg -c:v vc1_cuvid -i input2.wmv -c:v h264_nvenc output.mp4

C:\Users\Sun>cd G:\Xunlei Download\Mikami Yua (Mikami Yua)\TEK-067

C:\Users\Sun>g:

G:\Xunlei Download\Mikami Yua (Mikami Yua)\TEK-067>
G:\Xunlei Download\Mikami Yua (Mikami Yua)\TEK-067>dir
 drive The volume in G is 18680688682 and
 the serial number of the volume is 2A59-69C0

 G:\Xunlei Download\Mikami Yua (Mikami Yua)\TEK-067 directory

2023/03/18 19:03 <DIR> .
2023/03/18 19:03 <DIR> .. 2023/03/18
19:03 137,393 TEK-067.jpg
2023/03/17 10:46 7,785,976,422 TEK- 067.wmv
               2 files 7,786,113,815 bytes
               2 directories 133,153,181,696 available bytes

G:\Xunlei Download\Mikami Yua (三上溜亜-Mikami Yua)\TEK-067>ffmpeg -c:v vc1_cuvid -i TEK-067.wmv -c:v h264_nvenc d:\2.mp4 ffmpeg
version git-2020-06-28-4cfcfb3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 55.100 / 56. 55.100
  libavcodec     58. 93.100 / 58. 93.100
  libavformat    58. 47.100 / 58. 47.100
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, asf, from 'TEK-067.wmv':
  Metadata:
    copyright       : MUTEKI
    DeviceConformanceTemplate: AP@L3
    WM/WMADRCPeakReference: 32767
    WM/WMADRCPeakTarget: 32767
    WM/WMADRCAverageReference: 3283
    WM/WMADRCAverageTarget: 3283
    artist          : MUTEKI
    IsVBR           : 0
    WMFSDKNeeded    : 0.0.0.0000
    WMFSDKVersion   : 12.0.7601.17514
  Duration: 02:56:19.69, start: 0.000000, bitrate: 5887 kb/s
    Stream #0:0(jpn): Audio: wmapro (b[1][0][0] / 0x0162), 44100 Hz, stereo, fltp, 256 kb/s
    Stream #0:1(jpn): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5744 kb/s, 29.97 tbr, 1k tbn, 59.94 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (vc1 (vc1_cuvid) -> h264 (h264_nvenc))
  Stream #0:0 -> #0:1 (wmapro (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'd:\2.mp4':
  Metadata:
    copyright       : MUTEKI
    DeviceConformanceTemplate: AP@L3
    WM/WMADRCPeakReference: 32767
    WM/WMADRCPeakTarget: 32767
    WM/WMADRCAverageReference: 3283
    WM/WMADRCAverageTarget: 3283
    artist          : MUTEKI
    IsVBR           : 0
    WMFSDKNeeded    : 0.0.0.0000
    WMFSDKVersion   : 12.0.7601.17514
    encoder         : Lavf58.47.100
    Stream #0:0(jpn): Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), nv12(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.93.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
    Stream #0:1(jpn): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.93.100 aac
[aac @ 000001804f1195c0] Queue input is backward in time.94 bitrate=1954.7kbits/s speed=6.95x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 508373, current: 507900; changing to 508374. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.08 bitrate=2291.3kbits/s speed=7.56x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 2442202, current: 2441200; changing to 2442203. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.32 bitrate=2222.9kbits/s speed=8.25x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 9405416, current: 9403840; changing to 9405417. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 9405417, current: 9404864; changing to 9405418. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.36 bitrate=2137.0kbits/s speed=8.08x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 12993524, current: 12992477; changing to 12993525. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 12993525, current: 12993501; changing to 12993526. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.16 bitrate=2195.6kbits/s speed=7.77x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 30819293, current: 30818271; changing to 30819294. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.65 bitrate=2178.4kbits/s speed=7.88x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 39093227, current: 39092180; changing to 39093228. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 39093228, current: 39093204; changing to 39093229. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.19 bitrate=2189.7kbits/s speed= 7.9x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 40715225, current: 40714223; changing to 40715226. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.89 bitrate=2210.5kbits/s speed=6.41x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 84823029, current: 84821984; changing to 84823030. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 84823030, current: 84823008; changing to 84823031. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.48 bitrate=2189.7kbits/s speed=6.27x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93422573, current: 93421528; changing to 93422574. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93422574, current: 93422552; changing to 93422575. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.48 bitrate=2189.6kbits/s speed=6.27x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93619173, current: 93617597; changing to 93619174. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93619174, current: 93618621; changing to 93619175. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.35 bitrate=2188.6kbits/s speed=6.27x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93668344, current: 93666768; changing to 93668345. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93668345, current: 93667792; changing to 93668346. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.62 bitrate=2189.1kbits/s speed=6.26x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93897708, current: 93896662; changing to 93897709. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93897709, current: 93897686; changing to 93897710. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.20 bitrate=2188.1kbits/s speed=6.26x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94405608, current: 94404605; changing to 94405609. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.54 bitrate=2186.4kbits/s speed=6.25x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94831589, current: 94830567; changing to 94831590. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.51 bitrate=2185.3kbits/s speed=6.25x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94946274, current: 94945271; changing to 94946275. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.58 bitrate=2185.2kbits/s speed=6.25x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94995445, current: 94994399; changing to 94995446. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94995446, current: 94995423; changing to 94995447. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.39 bitrate=2183.1kbits/s speed=6.24x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 95241215, current: 95240168; changing to 95241216. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 95241216, current: 95241192; changing to 95241217. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.76 bitrate=2193.1kbits/s speed=6.21x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 98436078, current: 98435037; changing to 98436079. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 98436079, current: 98436061; changing to 98436080. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time2.88 bitrate=2200.1kbits/s speed=7.11x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 215712746, current: 215711710; changing to 215712747. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 215712747, current: 215712734; changing to 215712748. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time1.08 bitrate=2196.4kbits/s speed=7.12x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 216945622, current: 216944614; changing to 216945623. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time6.74 bitrate=2197.6kbits/s speed=7.14x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 221201399, current: 221200352; changing to 221201400. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 221201400, current: 221201376; changing to 221201401. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time5.43 bitrate=2213.6kbits/s speed=7.43x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 316339164, current: 316338164; changing to 316339165. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time3.78 bitrate=2203.3kbits/s speed=7.44x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 321651673, current: 321650141; changing to 321651674. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 321651674, current: 321651165; changing to 321651675. This may result in incorrect timestamps in the output file.
frame=317078 fps=229 q=24.0 Lsize= 2851835kB time=02:56:19.80 bitrate=2208.2kbits/s dup=6 drop=0 speed=7.64x
video:2677348kB audio:165245kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.325136%
[aac @ 000001804f1195c0] Qavg: 521.184

G:\Xunlei Download\Mikami Yua (Mikami Yua)\TEK-067>

 

 

 


During the transcoding process, the consumption of CPU and GPU is relatively large, maybe the computer I use is relatively old/classic!

 

 


References:
https://blog.csdn.net/ramondq/article/details/127803494
ffmpeg hardware accelerated wmv video transcoding
kotlean was modified at 2022-12-22 22:41:39

рекомендация

отblog.csdn.net/wb4916/article/details/129940806