Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to process video #4

Closed
vladimeeer opened this issue Aug 9, 2012 · 17 comments
Closed

Unable to process video #4

vladimeeer opened this issue Aug 9, 2012 · 17 comments

Comments

@vladimeeer
Copy link

Hi there, I am trying to process MP4 video to video with different resolution. There is used custom parameter.

Parameters for processing:
process encode_video: [:mp4, :resolution => "1280x720", :custom => "-pix_fmt yuv420p"]

There is an error that slow profile wasn't found.

Failed to transcode with FFmpeg. Check ffmpeg install and verify video is not corrupt or cut short. Original error: Failed encoding. Errors: no output file created. Full output: ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 24 2012 17:41:42 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
configuration: --prefix=/usr/local/Cellar/ffmpeg/0.11.1 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/llvm-gcc --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-libvo-aacenc --disable-ffplay
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/milan/github/lettr/tmp/uploads/20120809-0843-3534-7339/M4H00620.MP4':
Metadata:
major_brand : MSNV
minor_version : 19595353
compatible_brands: MSNVmp42isom
creation_time : 2010-08-21 17:37:22
Duration: 00:00:33.53, start: 0.000000, bitrate: 8908 kb/s
Stream #0:0(und): Video: mpeg4 (Advanced Coding Profile) (mp4v / 0x7634706D), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 8842 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
Metadata:
creation_time : 2010-08-21 17:37:22
handler_name : Video Media Handler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 24000 Hz, mono, s16, 64 kb/s
Metadata:
creation_time : 2010-08-21 17:37:22
handler_name : Sound Media Handler
Please use -q:a or -q:v, -qscale is ambiguous
File for preset 'slow' not found

@rheaton
Copy link
Owner

rheaton commented Aug 9, 2012

You should try to transcode the video with the streamio ffmpeg gem and make sure your ffmpeg install is correct.
This particular problem occurs because the "slow" preset for h264 encoding is being used and you don't have the file on your system.
I'd recommend using the presets as they give a better quality video, but you can pass in your own :custom params if you don't want to use them.

The preset files are here: http://www.mediasoftpro.com/aspnet-x264-presets.html
Depending on how you installed ffmpeg, you need to put them in the correct directory: http://ffmpeg.org/ffmpeg.html#Preset-files

I should probably update the docs with this info.

@rheaton
Copy link
Owner

rheaton commented Aug 9, 2012

I've updated the readme with notes about the presets. Closing this issue.

@rheaton rheaton closed this as completed Aug 9, 2012
@vladimeeer
Copy link
Author

Thanks. The link would be very helpful in readme.

@rheaton
Copy link
Owner

rheaton commented Aug 9, 2012

I added it! :)

@vladimeeer
Copy link
Author

Could you help me how can I change preset from slow to medium? I tried to set custom parameter with "-preset medium". It still used slow preset.

Thanks.

@rheaton
Copy link
Owner

rheaton commented Aug 13, 2012

Can you put the flags that it is being run with here so I can debug it?

@coreyti Would custom params allow for overriding the presets?

@coreyti
Copy link
Contributor

coreyti commented Aug 15, 2012

@vladimeeer and @rheaton, yes :custom will allow you to specify custom presets, and more. e.g.,

:custom => "-vpre slow -vpre hq"

@coreyti
Copy link
Contributor

coreyti commented Aug 15, 2012

...note that if you're on ffmpeg 0.11, I think the parameter changed for h264 presets. from -vpre to -preset

@vladimeeer
Copy link
Author

I've installed ffmpeg 0.11. I use following flags in video uploader:

process encode_video: [:mp4, resolution: :same, custom: "- preset medium -pix_fmt yuv420p"]

I got error:

Video Failed to transcode with FFmpeg. Check ffmpeg install and verify video is not corrupt or cut short. Original error: undefined method `/' for nil:NilClass

On Aug 13, 2012, at 4:33 PM, Rachel Heaton wrote:

Can you put the flags that it is being run with here so I can debug it?

@coreyti Would custom params allow for overriding the presets?


Reply to this email directly or view it on GitHub.

@coreyti
Copy link
Contributor

coreyti commented Aug 16, 2012

wow! that is not a very helpful error message :) do you have a logger set up? i believe that will show the actual ffmpeg command as run. might be helpful.

On Aug 14, 2012, at 6:06 PM, vladimeeer notifications@github.com wrote:

I've installed ffmpeg 0.11. I use following flags in video uploader:

process encode_video: [:mp4, resolution: :same, custom: "- preset medium -pix_fmt yuv420p"]

I got error:

Video Failed to transcode with FFmpeg. Check ffmpeg install and verify video is not corrupt or cut short. Original error: undefined method `/' for nil:NilClass

On Aug 13, 2012, at 4:33 PM, Rachel Heaton wrote:

Can you put the flags that it is being run with here so I can debug it?

@coreyti Would custom params allow for overriding the presets?


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub.

@vladimeeer
Copy link
Author

No, it's not very helpful :) How can I setup logger to see what command ran?
I use Rails.logger. When there are not set any custom parameters like this

process encode_video: [:mp4]

there is an error message:

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 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers built on Jun 24 2012 17:41:42 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) configuration: --prefix=/usr/local/Cellar/ffmpeg/0.11.1 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/llvm-gcc --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-libvo-aacenc --disable-ffplay libavutil 51. 54.100 / 51. 54.100 libavcodec 54. 23.100 / 54. 23.100 libavformat 54. 6.100 / 54. 6.100 libavdevice 54. 0.100 / 54. 0.100 libavfilter 2. 77.100 / 2. 77.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/milan/github/lettr/tmp/uploads/20120817-1548-771-5368/ForPitch.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: M4V mp42isom creation_time : 2011-08-22 20:50:24 Duration: 00:01:37.52, start: 0.000000, bitrate: 266 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x600 [SAR 1:1 DAR 4:3], 216 kb/s, 15 fps, 15 tbr, 15k tbn, 30 tbc Metadata: creation_time : 2011-08-22 20:50:24 handler_name : Video Media Handler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 47 kb/s Metadata: creation_time : 2011-08-22 20:50:24 handler_name : Sound Media Handler Please use -q:a or -q:v, -qscale is ambiguous [buffer @ 0x7fd74bc16040] w:800 h:600 pixfmt:yuv420p tb:1/15000 sar:1/1 sws_param:flags=2 [buffersink @ 0x7fd74bc16260] No opaque field provided [scale @ 0x7fd74bc15c00] w:800 h:600 fmt:yuv420p sar:1/1 -> w:640 h:480 fmt:yuv420p sar:1/1 flags:0x4 [NULL @ 0x7fd74c047200] [Eval @ 0x7fff641ef800] Undefined constant or missing '(' in 'bpyramid' [NULL @ 0x7fd74c047200] Unable to parse option value "bpyramid+mixed_refs+wpred+dct8x8+fastpskip+mbtree-wpred-dct8x8+mbtree" [NULL @ 0x7fd74c047200] Error setting option flags2 to value +bpyramid+mixed_refs+wpred+dct8x8+fastpskip+mbtree-wpred-dct8x8+mbtree. Output #0, mp4, to '/Users/milan/github/lettr/tmp/uploads/20120817-1548-771-5368/tmpfile.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: M4V mp42isom creation_time : 2011-08-22 20:50:24 Stream #0:0(eng): Video: none, yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 90k tbn, 15 tbc Metadata: creation_time : 2011-08-22 20:50:24 handler_name : Video Media Handler Stream #0:1(eng): Audio: none, 44100 Hz, stereo, s16, 128 kb/s Metadata: creation_time : 2011-08-22 20:50:24 handler_name : Sound Media Handler Stream mapping: Stream #0:0 -> #0:0 (h264 -> libx264) Stream #0:1 -> #0:1 (aac -> libfaac) Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

@rheaton
Copy link
Owner

rheaton commented Aug 17, 2012

Hi Vladimeer-

Were able to get streamio-ffmpeg to transcode the video without the gem options, or just using ffmpeg command line to transcode the video?

We saw an error like this when trying to work with a video that did not upload to completion, and there was nothing we could do about it. Our mac was able to play is with quicktime, but ffmpeg's mp4 library couldn't work with it.

@coreyti correct me if my memory is failing. ;)

@vladimeeer
Copy link
Author

were able to encode video in rails console with streamio-ffmpeg.
Here is what parameters I used:

movie = FFMPEG::Movie.new('/Users/milan/Desktop/ICT_showcase.mp4')
movie.transcode('hello.mp4',"-preset medium -pix_fmt yuv420p")

Here is result:

Running transcoding...
ffmpeg -y -i /Users/milan/Desktop/ICT_showcase.mp4 -preset medium -pix_fmt yuv420p 'hello.mp4'
Transcoding of /Users/milan/Desktop/ICT_showcase.mp4 to hello.mp4 succeeded

How did you solved your problem with that? It didn't work from me on local either on s3.

Thanks.

@rheaton
Copy link
Owner

rheaton commented Sep 4, 2012

Did you ever get this working?

Looks like the flags sent to ffmpeg from my gem are not correct.
When using the gem, can you get the flags that are being sent to ffmpeg?

You should be able to get this by setting the logger. You should also tail your application log as some stuff is written to standard out by the ffmpeg gem, I think.
I'm not currently working with carrierwave video, so sorry for the slow responses!

@coreyti
Copy link
Contributor

coreyti commented Sep 5, 2012

This has to do with a change between how the h.264 flags are set between ffmpeg versions 0.10 and 0.11: -vpre (I believe it was) became -preset. With the current version of carrierwave-vidoe, this can be accomplished using the :custom option.

Coreyhttp://about.me/coreyti

On Tuesday, September 4, 2012 at 7:09 PM, Rachel Heaton wrote:

Did you ever get this working?
Looks like the flags sent to ffmpeg from my gem are not correct.
When using the gem, can you get the flags that are being sent to ffmpeg?
You should be able to get this by setting the logger. You should also tail your application log as some stuff is written to standard out by the ffmpeg gem, I think.
I'm not currently working with carrierwave video, so sorry for the slow responses!


Reply to this email directly or view it on GitHub (#4 (comment)).

@vladimeeer
Copy link
Author

Actually, I have never got working this. I will try it with custom parameters this weekend. I am using it on my
hobby project lettr. You can take a look on http://send.lettr.co.

Thanks a lot for your help. I am glad for any help with :)
Hopefully, I will come with good news after weekend :D

@vladimeeer
Copy link
Author

Today, I took a look on the video processing. I set logger to get actual ffmpeg command. Video precessing was as you can see below:
process encode_video: [:mp4, custom: "-preset medium", logger: :log_video_processing]

There was this command in log.
ffmpeg -y -i /Users/milan/github/lettr/tmp/uploads/20120909-1115-859-0409/ForPitch.mp4 -vcodec libx264 -acodec libfaac -qscale 0 -vpre slow -vpre baseline -g 30 -s 640x480 -aspect 1.3333333333333333 '/Users/milan/github/lettr/tmp/uploads/20120909-1115-859-0409/tmpfile.mp4'

Even I set custom parameter. It wasn't in the actual command.
I will try it last time this way. Otherwise, I will process it directly with streamio when I won't manage it to work ;)

Thanks @rheaton and @coreyti for helping out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants