次のコードがあります。
var ffmpeg = require('fluent-ffmpeg');
var proc = new ffmpeg({source: media.file.path, nolog: false})
.withVideoCodec('libx264')
.withVideoBitrate(800)
.withAudioCodec('libvo_aacenc')
.withAudioBitrate('128k')
.withAudioChannels(2)
.toFormat('mp4')
.saveToFile(media.targetDir + media.getName() + '.' + '.mp4',
function (retcode, error) {
console.log('file has been converted succesfully');
});
fs.chmodSync(media.targetDir, '755');
mov
これにより、(うまくいけば)ファイルがファイルに変換されmp4
ます。しかし、そうではありません。代わりに、エラーやその他のコンソール メッセージを出力せずにコードを実行し、続行しますか?
だから私の質問は、私が間違ったことをしたのですか?
大したことではないことは承知していますが、質問があればいつでもお答えします。
proc
コードが実行された後の変数の図を次に示します。
コマンドの出力
次のコマンドを実行しました。
ffmpeg -i trim.F4A79C58-1141-412E-A713-2CF893F44055.MOV -c:v libx264 -vb 800k -c:a libfdk_aacenc -ab 128k -ac 2 test.mp4
そして、次の出力を得ました:
ffmpeg version N-76045-g97be5d4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libfreetype --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
libavutil 55. 4.100 / 55. 4.100
libavcodec 57. 6.100 / 57. 6.100
libavformat 57. 4.100 / 57. 4.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 11.100 / 6. 11.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3d494c0] moov atom not found
trim.F4A79C58-1141-412E-A713-2CF893F44055.MOV: Invalid data found when processing input
別のファイルを試行しました
別のファイルを試行したときの出力を次に示します (別のファイルが壊れている可能性があります)。
ffmpeg version N-76045-g97be5d4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libfreetype --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
libavutil 55. 4.100 / 55. 4.100
libavcodec 57. 6.100 / 57. 6.100
libavformat 57. 4.100 / 57. 4.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 11.100 / 6. 11.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2015-11-04 15:28:54
Duration: 00:00:02.21, start: 0.032948, bitrate: 751 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 91 kb/s (default)
Metadata:
creation_time : 2015-11-04 15:28:54
handler_name : Core Media Data Handler
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt709/bt709), 272x480, 647 kb/s, 24.04 fps, 24.08 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2015-11-04 15:28:54
handler_name : Core Media Data Handler
encoder : H.264
[libx264 @ 0x356d660] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x356d660] profile High, level 2.1
[libx264 @ 0x356d660] 264 - core 142 r2491 24e4fed - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
encoder : Lavf57.4.100
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 272x480, q=-1--1, 800 kb/s, 24.08 fps, 18496 tbn, 24.08 tbc (default)
Metadata:
creation_time : 2015-11-04 15:28:54
handler_name : Core Media Data Handler
encoder : Lavc57.6.100 libx264
Stream #0:1(und): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Metadata:
creation_time : 2015-11-04 15:28:54
handler_name : Core Media Data Handler
encoder : Lavc57.6.100 libvo_aacenc
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (aac (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
frame= 54 fps=0.0 q=-1.0 Lsize= 226kB time=00:00:02.30 bitrate= 803.3kbits/s dup=1 drop=0
video:187kB audio:37kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.346419%
[libx264 @ 0x356d660] frame I:1 Avg QP:18.97 size: 5651
[libx264 @ 0x356d660] frame P:16 Avg QP:16.05 size: 6730
[libx264 @ 0x356d660] frame B:37 Avg QP:17.38 size: 2086
[libx264 @ 0x356d660] consecutive B-frames: 3.7% 11.1% 11.1% 74.1%
[libx264 @ 0x356d660] mb I I16..4: 18.0% 56.5% 25.5%
[libx264 @ 0x356d660] mb P I16..4: 3.5% 14.9% 5.9% P16..4: 37.2% 26.1% 10.0% 0.0% 0.0% skip: 2.5%
[libx264 @ 0x356d660] mb B I16..4: 0.5% 1.3% 0.5% B16..8: 40.2% 8.6% 1.7% direct:18.9% skip:28.3% L0:47.4% L1:36.9% BI:15.7%
[libx264 @ 0x356d660] final ratefactor: 15.06
[libx264 @ 0x356d660] 8x8 transform intra:60.0% inter:47.9%
[libx264 @ 0x356d660] coded y,uvDC,uvAC intra: 86.0% 88.2% 37.7% inter: 33.7% 48.0% 2.6%
[libx264 @ 0x356d660] i16 v,h,dc,p: 27% 10% 44% 19%
[libx264 @ 0x356d660] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 14% 36% 4% 4% 6% 5% 5% 5%
[libx264 @ 0x356d660] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 16% 22% 5% 7% 8% 5% 5% 3%
[libx264 @ 0x356d660] i8c dc,h,v,p: 50% 18% 25% 7%
[libx264 @ 0x356d660] Weighted P-Frames: Y:6.2% UV:0.0%
[libx264 @ 0x356d660] ref P L0: 66.8% 11.1% 14.9% 6.6% 0.6%
[libx264 @ 0x356d660] ref B L0: 92.8% 6.0% 1.1%
[libx264 @ 0x356d660] ref B L1: 97.6% 2.4%
[libx264 @ 0x356d660] kb/s:679.79