Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • How to upload a video through PHP, transcode it via FFmpeg and upload it to a different server via FTP

    28 mai 2017, par PBXAI

    Currently I am building a video streaming platform and I need a way to upload my videos, through multiple resolutions to my Wowza server. I am currently running Ubuntu with Nginx, PHP and Wowza so I want to be able to, when the user uploads the video, encode it to 1080p, 720p, 480p, and 360p. How would I do this?

  • reduce bitrate using ffmpeg

    27 mai 2017, par WantIt

    I have this command to run with ffmpeg to reduce bitrate.

    ffmpeg -y -i input.mp4 -b:v 1024k output_1024k.mp4

    where we want to take the input file and just reduced it's bitrate (just 1024k). It works in the commandline. Now, I like to reduce bitrate via Java. I decided to use bytedeco/javacv FFmpegFrameGrabber and FFmpegFrameRecorder to perform the same function. Below is my code:

    FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("input.mp4");
                grabber.start();
    
                FrameRecorder recorder = new FFmpegFrameRecorder("out.mp4", grabber.getAudioChannels());
                recorder.setSampleRate(256);
                recorder.start();
    
                Frame frame;
                while ((frame = grabber.grabFrame()) != null) {
                    recorder.record(frame);
                }
                recorder.stop();
                grabber.stop(); 
    

    but it is saying the following error:

    org.bytedeco.javacv.FrameRecorder$Exception: avcodec_open2() error -22: Could not open audio codec.
        at org.bytedeco.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:732)
        at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:351)
        at com.goxhere.api.monte.resources.VideoResource.uploadFile(VideoResource.java:337)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:74)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:247)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:388)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:346)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:337)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:280)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:316)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1084)
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:418)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:372)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
    

    Basically the error says I have problem with audio codec, but when I tried to run the ffmpeg commandline directly, it reduces the bitrate just fine. Are we missing some setup in javacode? Thank you.

  • PHP large video upload converting to mp3 by ffmpeg

    27 mai 2017, par SuperBerry

    I am working on a project on Linux VPS (Apache + PHP5, 4G RAM / 2 CPU Cores) which allows users to upload videos (200M max) and convert to MP3 audio files by FFMPEG. I have few questions about the concurrency and the processing because I am a newbie on PHP:

    1. If there are 10 visitors uploading (1 visitor uploads one 200M MP4 file), will it cost 2,000M memory of the server? Will the chunk upload method could solve this memeory issue while more visitors uploading videos at the same time?

    2. I am going to use Redis to manage the ffmpeg processing queue, and set the crontab. Should I use the shell_exec() to call the ffmpeg to process the conversion at background, then convert the uploaded videos one by one?

    The uploading and conversion is the most cost for the server I think... Maybe my idea is extremely crazy...I am new to this type of service.. I didn't make online projects before, just desktop apps...

    Thanks a lot for your help..

  • Illegal instruction : 4 in ffmpeg

    27 mai 2017, par rs41

    I tried brew installed ffmpeg, i am also tried to compile ffmpeg but in all cases i have the error

    Illegal instruction: 4

    I run something like this:

    ./ffmpeg -i /Users/ruslan/Torrents/Weird\ smiling\ dog.3gp -codec:v libx264 -b:v 360k -maxrate 360k -bufsize 720k -movflags +faststart -vprofile high -preset slow -vf 'scale=trunc(iw/2)*2:360' -threads 0 -codec:a libfdk_aac -b:a 96k -ac 2 -f mp4 -threads 0 -y /dev/null >> /Users/ruslan/erosite/log/ffmpeg_convertation.log 2>&1
    Illegal instruction: 4
    

    Or only ffmpeg with options when used homebrews installed version

    Additional info:

    OS X Yosemite 10.10.2

    MacBook Pro (15-inch, Mid 2009)

  • Getting Audio issue on integrating YouTube Live Streaming in Android app

    27 mai 2017, par Basha

    Presently I was working in app which has an integration of YouTube Live streaming in my android application. I was using a project in GitHub(YT-Watch me), which is provided by YouTube for Live Streaming . Here I was able to get an live streaming video but not getting audio.Is there any change that I have to do in Ffmpeg-jni.c file?

    please suggest me how to solve this issue.