我正在测试视频转换,以将视频文件转换为mp4和webm。 我还设置了ffmpeg并正确编译。mp4转换成功,但webm中断始终抱怨为-
The encoder 'libvpx-vp9' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
在我出现vp8时感到很奇怪-
mike1011:~/workspace (s1) $ ffmpeg -encoders | grep -i vp
ffmpeg version git-2016-03-29-bf1495d Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
libavutil 55. 19.100 / 55. 19.100
libavcodec 57. 32.100 / 57. 32.100
libavformat 57. 29.101 / 57. 29.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 40.102 / 6. 40.102
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
V..... libvpx libvpx VP8 (codec vp8)
V..X.. libvpx-vp9 libvpx VP9 (codec vp9)
V..... wrapped_avframe AVFrame to AVPacket passthrough
A..... wavpack WavPack
我的模型..video.rb看起来像-
has_attached_file :video,
:styles => {
:mp4video => { :geometry => '1280x720>', :format => 'mp4',
:convert_options => { :output => { :vcodec => 'libx264', :movflags => '+faststart', :strict => :experimental} } },
:webmvideo => { :geometry => '1280x720>', :format => 'webm',
:convert_options => { :output => { :vcodec => 'libvpx-vp9'} } },
:oggvideo => { :geometry => '1280x720>', :format => 'ogg',
:convert_options => { :output => { :vcodec => 'libtheora',
:acodec => 'libvorbis', :strict => :experimental } } },
screenshot: { geometry: '640x480#', :convert_options => {
:output => { :vframes => 1, :s => '300x169', :ss => '00:00:02'} } }
},
:processors => [:transcoder],
###other setting comes here
##using delayed-paperclip for background processing of videos
process_in_background :video
def process_delayed!
unless self.video.job_is_processing
self.video.job_is_processing = true
self.video.post_processing = true
self.video.reprocess!
self.video.job_is_processing = false
end
end
我在下面共享我的完整输出(突出显示错误:))-
2.4.1 :003 > v=Video.find 25
Video Load (1.8ms) SELECT "videos".* FROM "videos" WHERE "videos"."id" = $1 LIMIT 1 [["id", 25]]
=> #<Video id: 25, videoable_id: 9, videoable_type: "ThirdPartyCaterer", video_file_name: "Sample320.mp4", video_content_type: "video/mp4", video_file_size: 1105773, video_updated_at: "2019-02-02 00:17:37", duration: 18.112, slug: "sample320-mp4-dbb96526-5db1-4c59-9152-615fc077eca7", active: true, created_at: "2019-02-02 00:17:37", updated_at: "2019-02-02 00:17:37", video_processing: true>
2.4.1 :004 > v.process_delayed!
[paperclip] copying /videos/25/original/Sample320.mp4 to local file /tmp/6b5665997c56c12544e7069276f6660b20190203-677953-1jsw8d1.mp4
[paperclip] Trying to link /tmp/6b5665997c56c12544e7069276f6660b20190203-677953-1jsw8d1.mp4 to /tmp/6b5665997c56c12544e7069276f6660b20190203-677953-1qmn2uk.mp4
I, [2019-02-03T00:12:09.849885 #677953] INFO -- : Running transcoding...
["/usr/local/bin/ffmpeg", "-y", "-i", "/tmp/6b5665997c56c12544e7069276f6660b20190203-677953-1jsw8d1.mp4", "-s", "360x240", "-aspect", "1.5", "/tmp/2f51a6ecbce019dcad28a46b5be980ec20190203-677953-rh2lh0.mp4"]
I, [2019-02-03T00:12:16.060391 #677953] INFO -- : Transcoding of /tmp/6b5665997c56c12544e7069276f6660b20190203-677953-1jsw8d1.mp4 to /tmp/2f51a6ecbce019dcad28a46b5be980ec20190203-677953-rh2lh0.mp4 succeeded
[paperclip] Trying to link /tmp/2f51a6ecbce019dcad28a46b5be980ec20190203-677953-rh2lh0.mp4 to /tmp/2961027361de4afbbb86f7764a034ee020190203-677953-1g0vvwe.mp4
I, [2019-02-03T00:12:16.082499 #677953] INFO -- : Running transcoding...
["/usr/local/bin/ffmpeg", "-y", "-i", "/tmp/6b5665997c56c12544e7069276f6660b20190203-677953-1jsw8d1.mp4", "-s", "360x240", "-aspect", "1.5", "/tmp/2f51a6ecbce019dcad28a46b5be980ec20190203-677953-fv3pzs.webm"]
E, [2019-02-03T00:12:16.202420 #677953] ERROR -- : Failed encoding...
["/usr/local/bin/ffmpeg", "-y", "-i", "/tmp/6b5665997c56c12544e7069276f6660b20190203-677953-1jsw8d1.mp4", "-s", "360x240", "-aspect", "1.5", "/tmp/2f51a6ecbce019dcad28a46b5be980ec20190203-677953-fv3pzs.webm"]
ffmpeg version git-2016-03-29-bf1495d Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3
libavutil 55. 19.100 / 55. 19.100
libavcodec 57. 32.100 / 57. 32.100
libavformat 57. 29.101 / 57. 29.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 40.102 / 6. 40.102
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/6b5665997c56c12544e7069276f6660b20190203-677953-1jsw8d1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.76.100
Duration: 00:00:18.11, start: 0.000000, bitrate: 488 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 360x240 [SAR 32:27 DAR 16:9], 353 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : SoundHandler
XXXXXXXXXXXXXXXXXXXXXXXX====== HERE COMES THE ERROR========XXXXXXXXXXXX
[libvpx-vp9 @ 0x3e3dec0] The encoder 'libvpx-vp9' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
Errors: encoded file is invalid.
Paperclip::Error: There was an error processing the transcoder for 6b5665997c56c12544e7069276f6660b20190203-677953-1jsw8d1
...