Closed wasimkham closed 9 years ago
can you post the full php code you are using please?
ignore. it was the example. hmmm. I will take a look at your ffmpeg output and see what the issue is
what are you using for your server? Xamp, mamp, vagrant?
Can you triple check it's not a config type or some such please?
I definitely triple checked it and it still didn't work, now all of a sudden I leave and come back later and it's working again. That's annoying, sorry for that!
One thing about the images and audio example, the output sound quality it really bad. How can I increase the quality (i've tried loads of different things and can't seem to get it to work).
Always the way isn't it!
Are you using the default example audio file? If so, that is meant to sound like an old video recording.
Yes it is! I did try with the default audio and i compared the 2 and the output on the video was definitely worse quality. I did realise that it's supposed to sound a bit old. But I tried with another audio file and the quality is definitely poor:
Original audio: https://dl.dropboxusercontent.com/u/51252143/triballove.mp3 Output video: https://dl.dropboxusercontent.com/u/51252143/my_homemade_video.mp4
I'm still using the example script with the same options, just changed the image & audio.
Ok, that is down to the output audio codec.
add
$output_format->setAudioCodec('mp3');
underneath $output_format->setVideoDimensions(320, 240);
Hmm that's a bit weird, now there's no sound at all. Here's the buffer output:
ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
built on Feb 8 2015 10:02:12 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-librtmp --enable-libfaac --enable-libfdk-aac --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, image2, from './examples/media/images/*.png':
Duration: 00:00:25.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgb24, 1920x1080, 0.04 tbr, 0.04 tbn, 0.04 tbc
[mp3 @ 0x7fb605000c00] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from './examples/media/triballove.mp3':
Metadata:
TSS : Logic Pro 9.0.0
Duration: 00:04:51.94, start: 0.000000, bitrate: 160 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 160 kb/s
[libx264 @ 0x7fb60500aa00] -qscale is ignored, -crf is recommended.
[libx264 @ 0x7fb60500aa00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x7fb60500aa00] profile High, level 3.1
[libx264 @ 0x7fb60500aa00] 264 - core 142 r2495 6a301b6 - 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=1 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=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to './examples/output/my_homemade_video.mp4':
Metadata:
encoder : Lavf56.15.102
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=-1--1, 0.04 fps, 16384 tbn, 0.04 tbc
Metadata:
encoder : Lavc56.13.100 libx264
Stream #0:1: Audio: mp3 (libmp3lame) (i[0][0][0] / 0x0069), 44100 Hz, stereo, s16p
Metadata:
encoder : Lavc56.13.100 libmp3lame
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (mp3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=17.0 Lsize= 458kB time=00:00:25.02 bitrate= 149.8kbits/s
video:51kB audio:402kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.108335%
[libx264 @ 0x7fb60500aa00] frame I:1 Avg QP:14.81 size: 51264
[libx264 @ 0x7fb60500aa00] mb I I16..4: 18.1% 61.3% 20.6%
[libx264 @ 0x7fb60500aa00] 8x8 transform intra:61.3%
[libx264 @ 0x7fb60500aa00] coded y,uvDC,uvAC intra: 61.9% 85.5% 77.9%
[libx264 @ 0x7fb60500aa00] i16 v,h,dc,p: 6% 9% 1% 85%
[libx264 @ 0x7fb60500aa00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 17% 9% 5% 8% 6% 9% 6% 6%
[libx264 @ 0x7fb60500aa00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 23% 9% 5% 9% 7% 7% 4% 4%
[libx264 @ 0x7fb60500aa00] i8c dc,h,v,p: 39% 25% 14% 22%
[libx264 @ 0x7fb60500aa00] kb/s:16.40
<c-924509-54fa080e68842-18565ed67af1f148b0f7ba0d0a80a61f>
instead of mp3 try copy
. Alternatively look at setting the bitrate of the output format instead.
$output_format->setAudioBitrate('192k');
Can you post the command sent to ffmpeg please?
/usr/local/bin/ffmpeg '-framerate' '1/25' '-pattern_type' 'glob' '-i' './examples/media/images/*.png' '-i' './examples/media/triballove.mp3' '-pix_fmt' 'yuv420p' '-shortest' '-y' '-q' '4' '-strict' 'experimental' '-threads' '1' '-acodec' 'mp3' '-s' '1280x720' '-r' '1/25' './examples/output/my_homemade_video.mp4'
Setting it as copy
doesn't work either.
I removed that line and tried
$output_format->setAudioBitrate('192k');
But again the quality is poor.
Really weird. Tried with $output_format->setAudioCodec('mp3');
again. The video shows when I open in Quicktime but no sound. When I open in VLC player - the audio plays but no video shows.
Right. try dicking around with the audio and video codec. This works well for me with your audio
->setAudioCodec('libfdk_aac')
->setVideoCodec('mpeg4');
@buggedcom what a legend! Works for me. Video still doesn't show in VLC but that's not an issue. I'll keep messing around with codecs. Appreciate your help.
np.
I'm trying to use the examples, specifically the
combine-images-to-video.php
which you kindly committed yesterday. Unfortunately even though I set the correct ffmpeg path in the config/usr/local/bin/ffmpeg
I get an exception thatFFmpeg appears to be unavailable on your system
.When I run
/usr/local/bin/ffmpeg
from terminal on my Mac it appears fineBear in mind I am using ffmpeg version 2.5.3 but I assume it would find the binary regardless of the version?