我尝试将 Galaxy s5 拍摄的 mp4 电影转换为 dvnxhd,但没有成功。
这是我的命令:
ffmpeg -i "/media/elomin/20170805_221129.mp4"
-map 0:0 -map 0:1 -threads 4 -aspect 16:9 -y
-f mov -acodec pcm_s16le -b:a 256k -ar 48000
-ac 2 -b:v 45000k -r 30.00 -vcodec dnxhd
"/home/elomin/Videos/studio_test_1.mov"
输出为:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/elomin/20170805_221129.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2017-08-05 20:13:02
Duration: 00:01:32.12, start: 0.000000, bitrate: 17050 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 16985 kb/s, 29.98 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 270
creation_time : 2017-08-05 20:13:02
handler_name : VideoHandle
Side data:
displaymatrix: rotation of 90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
creation_time : 2017-08-05 20:13:02
handler_name : SoundHandle
[dnxhd @ 0xed7500] video parameters incompatible with DNxHD. Valid DNxHD profiles:
...
[dnxhd @ 0xed7500] Frame size: 1920x1080p; bitrate: 45Mbps; pixel format: yuv422p; framerate: 30000/1001
...
Output #0, mov, to '/home/elomin/Videos/studio_test_1.mov':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
Stream #0:0(eng): Video: dnxhd, none, q=2-31, 128 kb/s, SAR 256:81 DAR 0:0, 30 fps (default)
Metadata:
handler_name : VideoHandle
creation_time : 2017-08-05 20:13:02
encoder : Lavc56.60.100 dnxhd
Stream #0:1(eng): Audio: pcm_s16le, 0 channels (default)
Metadata:
creation_time : 2017-08-05 20:13:02
handler_name : SoundHandle
encoder : Lavc56.60.100 pcm_s16le
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> dnxhd (native))
Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
这里出了什么问题?或者说无法将原始视频转换为这种格式?
答案1
正如我的同事所说指出对于使用 FFmpeg 进行 dnxhd 编码,有一组固定的帧大小与一些其他重要参数相匹配。
为了你的文件以下稍微简化的命令行应该可以实现您的目标:
ffmpeg -i "/media/elomin/20170805_221129.mp4" \
-c:a pcm_s16le \
-c:v dnxhd -vf scale=1920x1080,fps=24000/1001,format=yuv422p -b:v 115M \
"/home/elomin/Videos/studio_test_1.mov"
你实际上并没有需要重新缩放,因为您的输入视频是适合 dnxhd 的正确尺寸,但我将其保留在内,以便在输入视频尺寸不正确时演示所需的语法。
参考: