Git Product home page Git Product logo

lua---ffmpeg's People

Contributors

atcold avatar clementfarabet avatar fidlej avatar jtbates avatar jucor avatar kaixhin avatar lvdmaaten avatar marcoscoffier avatar sergomezcol avatar soumith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua---ffmpeg's Issues

bugs fixed in init.lua

local ffmpeg_cmd = (FFMPEG .. ' -r ' .. self.fps)
==>
local ffmpeg_cmd = ('ffmpeg -r ' .. self.fps)

Missing sys functions

The rockspec for this package in https://github.com/torch/rocks points to the tag 1.0-0 and the fix for the missing sys functions in the last commit is not included there. The package won't work correctly if installed with luarocks.

Doesn't return a table of tensors

If I call this as vid = ffmpeg.Video('somevideo.mp4') and then check the contents of vid with print(vid) it just shows "ffmpeg.Video", no "{...}" and I cannot seem to index into it. What is the format/type returned?

self.n_channels set to zero after loading

I am not sure if this is an issue or my misusage but I am going to report it anyways.

The following usage loads a video, but at the end of the constructor vid.n_channels is set to 0 by vid:clear()

require 'ffmpeg'

vid = ffmpeg.Video('office20150910.mp4')
print(vid.n_channels) --- prints 0

due to the fact vid.n_channels=0, the following functions won't work.

print(vid:forward()) -- returns {}
vid:save('test.avi')  -- generate empty test.avi

but if I manually set n_channels back to 1, everything work as expected.

vid = ffmpeg.Video('office20150910.mp4')
vid.n_channels = 1
print(#(vid:forward()))  -- this one return a 3d tensor of the frame.

video native resolution/fps

The current API forces you to set both the fps and the video resolution. It would be good to be able to query the video fps/resolution and/or be able to use the native resolution.

Possible memory leak

Hello,

It seems that after a few calls on ffmpeg.Video with the load parameter set to true, the memory used by the previous video is not freed even though the same object is used to recieve the return value of ffmpeg.Video.

Regards

EDIT : The memory leak is confirmed. Its due to image:load. Lua gc cant free tensors created by image:load...
https://groups.google.com/forum/#!topic/torch7/mWcQjP2WEVQ

Error in ffmpeg

FFMPEG bindings for Lua don't work. I have reproduced the error below.

ffmpeg works through command line. But not through Lua.

th> require 'ffmpeg'
{
  Video : {...}
}
                                                                      [0.0162s]
th> ffmpeg.Video()
WARNIN  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Video

loads a video into a table of tensors:
 + relies on ffpmeg, which must be installed
 + creates a local scratch/ to store temp frames on disk

> usage:
Video{
    [path = string]                     -- path to video
    [width = number]                    -- width  [default = 320]
    [height = number]                   -- height  [default = 240]
    [zoom = number]                     -- zoom factor  [default = 1]
    [fps = number]                      -- frames per second  [default = 10]
    [length = number]                   -- length, in seconds  [default = 10]
    [seek = number]                     -- seek to pos. in seconds  [default = 0]
    [channel = number]                  -- video channel  [default = 0]
    [load = boolean]                    -- loads frames after conversion  [default = true]
    [delete = boolean]                  -- clears (rm) frames after load  [default = true]
    [encoding = string]                 -- format of dumped frames  [default = png]
    [tensor = torch.Tensor]             -- provide a packed tensor (NxCxHxW or NxHxW), that bypasses path
    [destFolder = string]               -- destination folder  [default = scratch]
    [silent = boolean]                  -- suppress output  [default = false]
}

Video{width=number, path=string}
Video(string, ...)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/home/utkarsha/torch/install/share/lua/5.1/xlua/init.lua:320: error
stack traceback:
    [C]: in function 'error'
    /home/utkarsha/torch/install/share/lua/5.1/xlua/init.lua:320: in function 'error'
    /home/utkarsha/torch/install/share/lua/5.1/xlua/init.lua:543: in function 'unpack'
    /home/utkarsha/torch/install/share/lua/5.1/xlua/init.lua:603: in function 'unpack_class'
    /home/utkarsha/torch/install/share/lua/5.1/ffmpeg/init.lua:64: in function '__init'
    /home/utkarsha/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/utkarsha/torch/install/share/lua/5.1/torch/init.lua:87>
    [C]: in function 'Video'
    [string "_RESULT={ffmpeg.Video()}"]:1: in main chunk
    [C]: in function 'xpcall'
    /home/utkarsha/torch/install/share/lua/5.1/trepl/init.lua:650: in function 'repl'
    ...rsha/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
    [C]: at 0x00406670  

Misunderstanding

t7> ffmpeg.Video()
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Video

loads a video into a table of tensors:
 + relies on ffpmeg, which must be installed
 + creates a local scratch/ to store temp frames on disk

> usage:
Video{
    [path = string]                     -- path to video
    [width = number]                    -- width  [default = 320]
    [height = number]                   -- height  [default = 240]
    [fps = number]                      -- frames per second  [default = 10]
    [length = number]                   -- length, in seconds  [default = 10]
    [seek = number]                     -- seek to pos. in seconds  [default = 0]
    [channel = number]                  -- video channel  [default = 0]
    [load = boolean]                    -- loads frames after conversion  [default = true]
    [delete = boolean]                  -- clears (rm) frames after load  [default = true]
    [encoding = string]                 -- format of dumped frames  [default = png]
    [tensor = torch.Tensor]             -- provide a packed tensor (NxCxHxW or NxHxW), that bypasses path
}

Video{width=number, path=string}
Video(string, ...)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

If the fps = 10 and length = 10s, therefore there could be only 100 photograms?
How does this work?

Thanks

how to set silent=true?

Thank you for the good tools, it's very helpful to handle video files.
There is one little thing that makes me annoying.
When I use ffmpeg, there are so many log messages.
I want to reduce log messages. I saw the code and found that if silent=true then it would work. But I don't know how to set silent=true. Can you help me with that?

'libpng' not found

Hi,

I am getting the following error when loading the video. I am using CentOS.

Have tried installing image module but the issue persists.

/usr/local/torch/install/share/lua/5.1/xlua/init.lua:360: module 'libpng' not found:
no field package.preload['libpng']
no file '/root/.luarocks/share/lua/5.1/libpng.lua'
no file '/root/.luarocks/share/lua/5.1/libpng/init.lua'
no file '/usr/local/torch/install/share/lua/5.1/libpng.lua'
no file '/usr/local/torch/install/share/lua/5.1/libpng/init.lua'
no file './libpng.lua'
no file '/usr/local/torch/install/share/luajit-2.1.0-beta1/libpng.lua'
no file '/usr/local/share/lua/5.1/libpng.lua'
no file '/usr/local/share/lua/5.1/libpng/init.lua'
no file '/usr/local/torch/install/lib/libpng.so'
no file '/root/.luarocks/lib/lua/5.1/libpng.so'
no file '/usr/local/torch/install/lib/lua/5.1/libpng.so'
no file './libpng.so'
no file '/usr/local/lib/lua/5.1/libpng.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
warning: could not be loaded (is it installed?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.