Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG .oma to .mp3 "Unsupported codec 5 !" with a big file

    27 mars 2017, par Ventura

    I'm trying to convert a .OMA file to .MP3 but no success with a specific file.

    If I try:

    ffmpeg -i audio1.oma -f mp3 output.mp3
    

    The file is converted successfully. The file audio1.oma is a 3 MB file.

    Full output:

    ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
      built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
      libavutil      55. 34.101 / 55. 34.101
      libavcodec     57. 64.101 / 57. 64.101
      libavformat    57. 56.101 / 57. 56.101
      libavdevice    57.  1.100 / 57.  1.100
      libavfilter     6. 65.100 /  6. 65.100
      libavresample   3.  1.  0 /  3.  1.  0
      libswscale      4.  2.100 /  4.  2.100
      libswresample   2.  3.100 /  2.  3.100
      libpostproc    54.  1.100 / 54.  1.100
    [oma @ 0x7f8fc4000000] Estimating duration from bitrate, this may be inaccurate
    Input #0, oma, from 'audio1.oma':
      Metadata:
        title           : Is This It
        artist          : The Strokes
        album           : Is This It
        genre           : Rock
        OMG_TRLDA       : 2001/01/01 00:00:00
        TLEN            : 153000
      Duration: 00:02:33.36, start: 0.000000, bitrate: 128 kb/s
        Stream #0:0: Audio: mp3 ([3][0][0][0] / 0x0003), 44100 Hz, stereo, s16p, 128 kb/s
    Output #0, mp3, to 'output.mp3':
      Metadata:
        TIT2            : Is This It
        TPE1            : The Strokes
        TALB            : Is This It
        TCON            : Rock
        OMG_TRLDA       : 2001/01/01 00:00:00
        TLEN            : 153000
        TSSE            : Lavf57.56.101
        Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p
        Metadata:
          encoder         : Lavc57.64.101 libmp3lame
    Stream mapping:
      Stream #0:0 -> #0:0 (mp3 (native) -> mp3 (libmp3lame))
    Press [q] to stop, [?] for help
    size=    2397kB time=00:02:33.35 bitrate= 128.0kbits/s speed=37.2x    
    video:0kB audio:2397kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.016094%
    

    If I try the same with another .oma (53 MB) I'm getting the error:

    Unsupported codec 5! audio2.oma: Function not implemented

    Full output:

    ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
      built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
      libavutil      55. 34.101 / 55. 34.101
      libavcodec     57. 64.101 / 57. 64.101
      libavformat    57. 56.101 / 57. 56.101
      libavdevice    57.  1.100 / 57.  1.100
      libavfilter     6. 65.100 /  6. 65.100
      libavresample   3.  1.  0 /  3.  1.  0
      libswscale      4.  2.100 /  4.  2.100
      libswresample   2.  3.100 /  2.  3.100
      libpostproc    54.  1.100 / 54.  1.100
    [oma @ 0x7f8792000000] Unsupported codec 5!
    audio2.OMA: Function not implemented
    

    Both audios works fine when using the MP3 Player. The first audio which works is just a random song from my MP3 player to test. The second file was recorded in a music studio playing live with multiple channels.

    Anything I'm missing here?

  • There are error about ffmpeg in python

    27 mars 2017, par WHOAMI
    from ffmpy import FFmpeg
    import ffmpy
    
    ff = FFmpeg(inputs={'screenrecord.mp4':None},
                outputs={'C:\\Users\pc\Desktop\CM\03.24\Demo\output.mp4':None})
    
    #ff.cmd
    ff.run()
    

    following is the error message.

    C:\Users\pc\AppData\Local\Programs\Python\Python36\python.exe C:/Users/pc/Desktop/CM/03.24/Demo/Demo.py
    Traceback (most recent call last):
      File "C:\Users\pc\AppData\Local\Programs\Python\Python36\lib\site-packages\ffmpy-0.2.2-py3.6.egg\ffmpy.py", line 95, in run
      File "C:\Users\pc\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 707, in __init__
        restore_signals, start_new_session)
      File "C:\Users\pc\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 990, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] 系统找不到指定的文件。
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:/Users/pc/Desktop/CM/03.24/Demo/Demo.py", line 8, in 
        ff.run()
      File "C:\Users\pc\AppData\Local\Programs\Python\Python36\lib\site-packages\ffmpy-0.2.2-py3.6.egg\ffmpy.py", line 99, in run
    ffmpy.FFExecutableNotFoundError: Executable 'ffmpeg' not found
    

    Process finished with exit code 1

  • Rails 4.2.8 Using Paperclip With Resque

    27 mars 2017, par AntonioMarquis

    My application uploads training videos to a S3 bucket. I need the transcoding videos to be processed in the background so they don't tie up the application. I want to use Resque on my dev machine and Heroku. But my jobs continue to fail.

    Model

    has_attached_file :video
    
    process_in_background :video 
    

    Gems

    gem 'aws-sdk', '< 2.0'
    gem 'paperclip'
    gem 'paperclip-av-transcoder'
    gem "paperclip-ffmpeg"
    gem "ffmpeg"
    gem 'daemons'
    gem 'delayed_paperclip'
    gem 'nokogiri'#, '~> 1.5.9'
    gem 'rmagick'
    gem 'resque', "~> 1.22.0"
    

    Output from Failed Jobs

    Class ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper
    
    Arguments {"job_class"=>"DelayedPaperclip::Jobs::ActiveJob", "job_id"=>"111e4f9d-942d-4613-b3cb-0e884581249f", "queue_name"=>"paperclip", "arguments"=>["Video", 30, "source"], "locale"=>"en"}
    
    Exception NoMethodError
    
    Error undefined method `call' for "result == false":String
    
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:165:in `block in halting'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `block in call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `each'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_source_post_process_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/callbacks.rb:26:in `run_paperclip_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/attachment.rb:419:in `block in post_process'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_post_process_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/callbacks.rb:26:in `run_paperclip_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/attachment.rb:418:in `post_process'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/attachment.rb:112:in `assign'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/attachment.rb:322:in `reprocess!'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/delayed_paperclip-2.10.0/lib/delayed_paperclip/attachment.rb:68:in `process_delayed!'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/delayed_paperclip-2.10.0/lib/delayed_paperclip.rb:36:in `process_job'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/delayed_paperclip-2.10.0/lib/delayed_paperclip/jobs/active_job.rb:10:in `perform'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/execution.rb:32:in `block in perform_now'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:343:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/i18n-0.8.1/lib/i18n.rb:257:in `with_locale'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/translation.rb:7:in `block (2 levels) in '
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:441:in `instance_exec'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:441:in `block in make_lambda'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:342:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:342:in `block in simple'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:497:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:497:in `block in around'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:343:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:23:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:23:in `block (4 levels) in '
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:22:in `block (3 levels) in '
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:43:in `block in tag_logger'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `block in tagged'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:26:in `tagged'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `tagged'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:43:in `tag_logger'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:19:in `block (2 levels) in '
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:441:in `instance_exec'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:441:in `block in make_lambda'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:342:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:342:in `block in simple'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:497:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:497:in `block in around'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_perform_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/execution.rb:31:in `perform_now'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/execution.rb:21:in `execute'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/queue_adapters/resque_adapter.rb:46:in `perform'
    Powered by Resque v1.22.0
    Connected to Redis namespace resque on redis://127.0.0.1:6379/0
    
  • Paperclip geometry ignored

    27 mars 2017, par ACIDSTEALTH

    I have a model called Snapshot, which represents a user-recorded video. I want to take the input video file and scale it to fit within a 720x720 box (ImageMagick documentation). I then want to capture some screenshots of the video to represent it in my app. These sizes are specified accordingly in my model.

    I expect the output of this to be an original video with a maximum width of 720px (assuming it was recorded in landscape mode), a large JPG image with a maximum width of 540px, etc.

    When I attach the video file and save the model, the images and video file are processed but the result is not what I expected. The video file has a resolution of 960x720 and the images are all square (540x540, 360x360, etc).

    I'm not sure if I'm doing something wrong or if this is just a bug with Paperclip. Here is my code:

    class Snapshot < ApplicationRecord
        has_attached_file :video,
            styles: {
                original: { geometry: "720x720", format: 'mp4' },
                large: { geometry: "540x540", format: 'jpg' },
                medium: { geometry: "360x360", format: 'jpg' },
                thumb: { geometry: "180x180", format: 'jpg' }
            },
            default_url: "", processors: [:transcoder]
        validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
        validates_attachment_size :video, less_than: 100.megabytes
    end
    

    I have also tried adjusting the geometry to 720x720>, 540x540>, etc. When I did this, the attachments' resolution was unchanged, which seems to go completely against my understanding of how ImageMagick geometry works. I have numerous other models with image-only attachments that do not suffer from this issue.

    Here is a snippet from my Gemfile.lock so you can see which versions I am running:

    delayed_paperclip (3.0.1)
      activejob (>= 4.2)
      paperclip (>= 3.3)
    paperclip (5.1.0)
      activemodel (>= 4.2.0)
      activesupport (>= 4.2.0)
      cocaine (~> 0.5.5)
      mime-types
      mimemagic (~> 0.3.0)
    paperclip-av-transcoder (0.6.4)
      av (~> 0.9.0)
      paperclip (>= 2.5.2)
    paperclip-optimizer (2.0.0)
      image_optim (~> 0.19)
      paperclip (>= 3.4)
    

    Update I retried this with a video recorded in portrait mode (iPhone 6 front-facing webcam) and the video file's output size was 720x720. The images were still square as before.

  • ffmpeg encoding for HTML 5 - Primefaces/JSF

    27 mars 2017, par Mitsos

    I am trying to build a web app (using Primefaces) that streams real time video on an html page. The video is captured using an HDMI to IP encoder(TBS2603), that outputs the stream to HTTP. The video is show on the page using:

      
    

    BUT the video is not show on the page using tag. As I want to stream on mobile devices and I need to use stream. Therefore I have to transcode the stream using ffmpeg (not ffserver - as it will be deprecated on future releases), and publishing it on Tomcat on another context allowing listing.

    I am creating 3 streams on 3 files (ogg/mp4/webm)

    MP4

    ffmpeg -i http://ip:8080/hdmi -vcodec libx264 -b:v 8192k -f segment -segment_time 4 -segment_list_size 0 -segment_list test.m3u8 -segment_format mpegts stream%05d.ts
    

    OGG

    ffmpeg -i http://ip:8080/hdmi -acodec vorbis -vcodec libtheora test.ogg
    

    WEBM

    ffmpeg -i http://ip:8080/hdmi -vcodec libvpx -acodec libvorbis test.webm
    

    The streams are loaded on jsf:

      
    

    In this manner I get the output from the encoded files - how can I get the real time stream from the encoder?