2017-05-02 2 views
1

スクリプトを手動で実行すると、mp3 +オーディオをmp4に変換できます。ffmpegは手動で動作しますが、cronでは動作しませんか?

exec("/usr/bin/ffmpeg -loop 1 -i $destination_thumbnail -i $input_file -c:a copy -c:v libx264 -shortest $videoPath 2>&1",$output); 

私は上記のコードをcronで実行されたスクリプトに入れても変換しません。私はこのエラーが発生します。

Array 
(
    [0] => ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers 
    [1] => built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4) 
    [2] => configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect 
    [3] => libavutil  54. 20.100/54. 20.100 
    [4] => libavcodec  56. 26.100/56. 26.100 
    [5] => libavformat 56. 25.101/56. 25.101 
    [6] => libavdevice 56. 4.100/56. 4.100 
    [7] => libavfilter  5. 11.102/5. 11.102 
    [8] => libavresample 2. 1. 0/2. 1. 0 
    [9] => libswscale  3. 1.101/3. 1.101 
    [10] => libswresample 1. 1.100/1. 1.100 
    [11] => libpostproc 53. 3.100/53. 3.100 
    [12] => [mp3 @ 0x1d62bc0] Estimating duration from bitrate, this may be inaccurate 
    [13] => Input #0, mp3, from '/home/example/public_html/wp-content/channels/videos/temp_1473937603.mp3': 
    [14] => Duration: 00:06:51.05, start: 0.000000, bitrate: 64 kb/s 
    [15] =>  Stream #0:0: Audio: mp3, 16000 Hz, stereo, s16p, 64 kb/s 
    [16] => [mjpeg @ 0x1d73de0] Changeing bps to 8 
    [17] => Input #1, image2, from '/home/examples/public_html/wp-content/channels/thumbnails/thumbnail_516919517.jpg': 
    [18] => Duration: 00:00:00.50, start: 0.000000, bitrate: N/A 
    [19] =>  Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 250x135 [SAR 1:1 DAR 50:27], 2 fps, 2 tbr, 2 tbn, 2 tbc 
    [20] => No pixel format specified, yuvj420p for H.264 encoding chosen. 
    [21] => Use -pix_fmt yuv420p for compatibility with outdated media players. 
    [22] => [libx264 @ 0x1d75240] height not divisible by 2 (250x135) 
    [23] => Output #0, mp4, to '/home/example/public_html/wp-content/channels/videos/temp_1473937603.mp4': 
    [24] =>  Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 2 fps 
    [25] =>  Metadata: 
    [26] =>  encoder   : Lavc56.26.100 libx264 
    [27] =>  Stream #0:1: Audio: none, 0 channels, 128 kb/s 
    [28] => Stream mapping: 
    [29] => Stream #1:0 -> #0:0 (mjpeg (native) -> h264 (libx264)) 
    [30] => Stream #0:0 -> #0:1 (copy) 
    [31] => Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height 
) 

なぜ私は手動でconversion.phpでスクリプトを実行したときに、この作業を行いますが、私はcronを経由conversion.phpを実行したときに、私は上記のエラーを取得しますか?それが言うように、コンソールに

+0

がフルスクリプトファイルconversion.php –

+0

@AMitGuadファイルを入れてください追加は、投稿するには大きすぎるが、それは手動で動作します。 – mdnba50

答えて

1

[libx264 @ 0x1d75240] height not divisible by 2 (250x135)

-vf "scale='2*trunc(iw/2)':'2*trunc(ih/2)'"

+0

私はこれを私のコマンドに入れますか?私はffmpegを持つ初心者です。 – mdnba50

+0

最後の入力 '-i $ input_file 'の後で、出力名' $ videoPath'の前のどこでも – Mulvya

関連する問題