I ve tried to upload videos using Carrierwave-video & FFmpeg. I've installed FFmpeg and there is no problem with installation. I have made configurations from ' http://blog.41studio.com/upload-videos-using-carrierwave-ffmpeg/ ' .But when I tried to upload video (.mov file), I have an error.
Error
Video Failed to transcode with FFmpeg. Check ffmpeg install and verify video is not corrupt or cut short. Original error: Failed encoding.Errors: encoded file is invalid. Full output: ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers built with Apple LLVM version 7.0.0 (clang-700.1.76) configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfaac --enable-nonfree --enable-vda libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/tanerkoroglu/Desktop/Wishpere2/public/uploads/tmp/1449435556-7186-2107/IMG_1756.MOV': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2015-10-17 12:19:27 Duration: 00:01:04.24, start: 0.000000, bitrate: 17176 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17082 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler encoder : H.264 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 85 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Please use -q:a or -q:v, -qscale is ambiguous [Parsed_movie_0 # 0x7feb6bf00100] Failed to avformat_open_input '/Users/tanerkoroglu/Desktop/Wishpere2/app/assets/images/logo.png' [AVFilterGraph # 0x7feb6bc09240] Error initializing filter 'movie' with args '/Users/tanerkoroglu/Desktop/Wishpere2/app/assets/images/logo.png' Error opening filters!
video_uploader.rb
class VideoUploader < CarrierWave::Uploader::Base
include CarrierWave::Video
process :encode
def encode
encode_video(:mp4, watermark: {path: File.join(Rails.root, "app/assets/images/logo.png")})
end
version :mp4 do
def full_filename(for_file)
super.chomp(File.extname(super)) + '.mp4'
end
end
end
Gemfile
gem 'carrierwave', '0.10.0'
gem 'carrierwave-video'
gem 'streamio-ffmpeg'
I had the same error. In my case it was because of carrierwave-video is incompatible with streamio-ffmpeg (3.0.2). streamio-ffmpeg expects to receive array of format_params, but carrierwave-video returns a string. I fixed it in my fork
Related
Problem
Recently I uploaded App preview video to my app in iTunesConnect
It looks like it was uploaded successfully, I was able to play it but there was a text overlay on the video preview:
Processing App Preview
The app preview can take up to 24 hours to process.
I have closed Safari and go to sleep. Next morning I see this
Questions
How can I get a reason why this happens, as far as I see my video conform to https://help.apple.com/app-store-connect/#/dev4e413fcb8 , here is ffprobe output for it
ffprobe version 4.1.4 Copyright (c) 2007-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.4_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-12.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-12.0.1.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/camobap/my_video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:30.04, start: 0.000000, bitrate: 1512 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 886x1920, 1377 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 130 kb/s (default)
Metadata:
handler_name : #Mainconcept MP4 Sound Media Handler
Who actually does this video review? Humans or machines?
Is there any automation script to do this validation before upload?
Silly me, looks like 24 hours wasn't passed, once I waited more time this problem just gone
P.S. only Safari show this, there is no error in Google Chrome
P.P.S sometimes it happens even for successfully processed video but after a page refresh, the problem is gone
I'm facing an issue using ffmpeg to convert video, precisely mp4 video => Http Live Streaming (HLS)
Once converted to HLS, the .m3u8 file has a wrong duration (e.g : 20,1s instead of 20.00s), causing bugs when playing it with AVPlayer on iOS.
Playing the video with Safari cause the same issue.
Example :
1) Open Safari
2) Play this video that i've converted
3) Look at the download progression, stopped at 98% cause of wrong duration.
4) When you slide between 98% and 100%, the video player can crash.
EDIT 1 :
I've edited the command line
ffmpeg -i video.mp4 \
-codec copy \
-acodec copy \
-map 0 -f ssegment -g 60 -sc_threshold 0 \
-segment_list playlist.m3u8 \
-segment_list_flags +live \
-segment_time 2 media%05d.ts \
>./log_ffmpeg 2>./log_ffmpeg
LOG :
ffmpeg version 3.1.4-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.1 (Debian 5.4.1-2) 20160904
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libzimg --cc=gcc-5 --disable-ffplay
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './Comptes/1/Photos/306/original_video.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2016-10-12 14:29:51
Duration: 00:00:20.00, start: 0.000000, bitrate: 1673 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 540x960, 1563 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2016-10-12 14:29:51
handler_name : Core Media Video
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 101 kb/s (default)
Metadata:
creation_time : 2016-10-12 14:29:51
handler_name : Core Media Audio
[stream_segment,ssegment # 0x652ed80] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, stream_segment,ssegment, to './Comptes/1/Photos/306/media%05d.ts':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
encoder : Lavf57.41.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 540x960, q=2-31, 1563 kb/s, 30 fps, 30 tbr, 90k tbn, 600 tbc (default)
Metadata:
creation_time : 2016-10-12 14:29:51
handler_name : Core Media Video
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, 101 kb/s (default)
Metadata:
creation_time : 2016-10-12 14:29:51
handler_name : Core Media Audio
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 601 fps=0.0 q=-1.0 Lsize=N/A time=00:00:20.10 bitrate=N/A speed= 917x
video:3823kB audio:249kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
m3u8 file :
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:3
#EXTINF:2.033333,
media00000.ts
#EXTINF:2.000000,
media00001.ts
#EXTINF:2.000000,
media00002.ts
#EXTINF:2.000000,
media00003.ts
#EXTINF:2.000000,
media00004.ts
#EXTINF:2.000000,
media00005.ts
#EXTINF:2.000000,
media00006.ts
#EXTINF:2.000000,
media00007.ts
#EXTINF:2.000000,
media00008.ts
#EXTINF:2.000000,
media00009.ts
#EXTINF:0.033333,
media00010.ts
#EXT-X-ENDLIST
As you can see input duration =/= output duration
input duration : 20s
output duration 20.1s
i have a rails application and change to cookie_store to active_record_store, but when i used a converter video in ffmpeg i getting this error
Maybe someone can help me to solve it?
error while running command ffmpeg -i "/tmp/9ce6ffe844cfb53c6adb76fef1f3330020160930-13071-hutiuw.mp4" -acodec aac -strict experimental -vcodec libx264 -s 720x405 -y "/tmp/9ce6ffe844cfb53c6adb76fef1f3330020160930-13071-hutiuw20160930-13071-1xp6lwi.mp4": Command 'PATH=/usr/local/bin/:$PATH; ffmpeg -i "/tmp/9ce6ffe844cfb53c6adb76fef1f3330020160930-13071-hutiuw.mp4" -acodec aac -strict experimental -vcodec libx264 -s 720x405 -y "/tmp/9ce6ffe844cfb53c6adb76fef1f3330020160930-13071-hutiuw20160930-13071-1xp6lwi.mp4"' returned 1. Expected 0 Here is the command output: STDOUT: STDERR: ffmpeg version 2.8.6-1ubuntu2 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.1 (Ubuntu 5.3.1-11ubuntu1) 20160311 configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/i386-linux-gnu --incdir=/usr/include/i386-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --disable-i686 libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/9ce6ffe844cfb53c6adb76fef1f3330020160930-13071-hutiuw.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2016-07-12 16:30:41 Duration: 00:04:38.96, start: 0.000000, bitrate: 1520 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1325 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s (default) Metadata: creation_time : 2016-07-12 16:30:42 handler_name : IsoMedia File Produced by Google, 5-11-2011 [libx264 # 0xa1105e0] height not divisible by 2 (720x405) Output #0, mp4, to '/tmp/9ce6ffe844cfb53c6adb76fef1f3330020160930-13071-hutiuw20160930-13071-1xp6lwi.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 Stream #0:0(und): Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 29.97 fps (default) Metadata: handler_name : VideoHandler encoder : Lavc56.60.100 libx264 Stream #0:1(eng): Audio: aac, 0 channels, 128 kb/s (default) Metadata: creation_time : 2016-07-12 16:30:42 handler_name : IsoMedia File Produced by Google, 5-11-2011 encoder : Lavc56.60.100 aac Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (aac (native) -> aac (native)) Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
I don't think your choice of cookie store had anything to do with that. This happened because you chose a video file with this particular input size (1280x720).
Error is:
[libx264 # 0xa1105e0] height not divisible by 2 (720x405)
There are plenty questions on this site about this error but in the end it boils down to a simple answer: "make sure encoded picture has even width and height". In your case output picture size (720x405) is passed down from your site code so you need to fix it there.
I ve tried to upload videos using Carrierwave-video & FFmpeg. I've installed FFmpeg and there is no problem with installation. I have made configurations (I'm not sure from them) from but when I tried to upload video (.mov file), I have an error.
Please help me to fix this problem with Carrierwave & FFmpeg or please guide to me uploading videos to my app with different ways. (Note: I am using Carrierwave for uploading images to my app, and it works perfect)
Thanks for your attention.
Error
Video Failed to transcode with FFmpeg. Check ffmpeg install and verify video is not corrupt or cut short. Original error: Failed encoding.Errors: encoded file is invalid. Full output: ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers built with Apple LLVM version 7.0.0 (clang-700.1.76) configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfaac --enable-nonfree --enable-vda libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/tanerkoroglu/Desktop/Wishpere2/public/uploads/tmp/1449435556-7186-2107/IMG_1756.MOV': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2015-10-17 12:19:27 Duration: 00:01:04.24, start: 0.000000, bitrate: 17176 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17082 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler encoder : H.264 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 85 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default) Metadata: creation_time : 2015-10-17 12:19:27 handler_name : Core Media Data Handler Please use -q:a or -q:v, -qscale is ambiguous [Parsed_movie_0 # 0x7feb6bf00100] Failed to avformat_open_input '/Users/tanerkoroglu/Desktop/Wishpere2/app/assets/images/logo.png' [AVFilterGraph # 0x7feb6bc09240] Error initializing filter 'movie' with args '/Users/tanerkoroglu/Desktop/Wishpere2/app/assets/images/logo.png' Error opening filters!
video_uploader.rb
class VideoUploader < CarrierWave::Uploader::Base
include CarrierWave::Video
process :encode
def encode
encode_video(:mp4, watermark: {path: File.join(Rails.root, "app/assets/images/logo.png")})
end
version :mp4 do
def full_filename(for_file)
super.chomp(File.extname(super)) + '.mp4'
end
end
end
Gemfile
gem 'carrierwave', '0.10.0'
gem 'carrierwave-video'
gem 'streamio-ffmpeg'
I am currently developing an app which involves uploading video to the server. The video is on .MOV format since it comes from an iOS Device. I have set-up FFMPEG on the server already. But everytime I try to upload a video, an FFMPEG error comes out:
FFMPEG::Error (Failed encoding.Errors: encoded file is invalid. Full output: ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Oct 26 2015 08:48:47 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --enable-gpl --enable-version3 --enable-shared --enable-nonfree --enable-postproc
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/deploy/production/pinoymobiledirectory-ws/public/uploads/tmp/20151029-0424-12438-7062/tmpfile':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2015-10-29 04:24:11
Duration: 00:00:05.38, start: 0.000000, bitrate: 784 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s
Metadata:
creation_time : 2015-10-29 04:24:11
handler_name : Core Media Data Handler
Stream #0:1(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 480x360, 715 kb/s, 30.11 fps, 29.97 tbr, 600 tbn, 1200 tbc
Metadata:
rotate : 90
creation_time : 2015-10-29 04:24:11
handler_name : Core Media Data Handler
[aac # 0x143c980] The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
):
lib/carrierwave/ffmpeg.rb:19:in encode_video'
app/controllers/v1/businesses_assets_controller.rb:33:inupload_video'
Anyone who also got the same error as mine? How did you solved it?
The key part of the message is 'The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it'.
You need to add this flag to your ffmpeg command. For example the following command, which will compress an mp4 video, contains this flag:
ffmpeg -i BigBuckBunny_320x180.mp4 -strict experimental -acodec aac CompressedBBB_320x180_aac.mp4
Fixed it by installing the latest FFMPEG.
Followed this guide: https://gist.github.com/xdamman/e4f713c8cd1a389a5917