2014年10月6日 星期一

QT with ffmpeg issue (updating)


  •  Linking problem : Linker can't find ffmpeg function. Because ffmpeg exports C function, QT works in C++.

Linker encounters problem in decorated functions names.
Solution :


  • using extern "C" {}
extern "C" {
#include "libavutil/mathematics.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
.....
}
  • modify *.pro

INCLUDEPATH += /usr/local/include
LIBS += -LC:/usr/local/lib -lavcodec -lavutil -lavformat -lavdevice -lavfilter -lswscale

unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += libavcodec
unix: PKGCONFIG += libavutil
unix: PKGCONFIG += libavformat
unix: PKGCONFIG += libavdevice
unix: PKGCONFIG += libavfilter
unix: PKGCONFIG += libswscale

adding ffmpeg lib, follow below method
http://doc.qt.digia.com/qtcreator-2.1/creator-project-qmake-libraries.html




  • #error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
Solution : __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are a workaround to allow C++ programs to use stdint.h macros specified in the C99 standard that aren't in the C++ standard. The macros, such as UINT8_MAX, INT64_MIN, and INT32_C() may be defined already in C++ applications in other ways. To allow the user to decide if they want the macros defined as C99 does, many implementations require that __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS be defined before stdint.h is included.
This isn't part of the C++ standard, but it has been adopted by more than one implementation.


2014年8月5日 星期二

Comment out multiple lines using vim

Reference
http://www.linuxask.com/questions/comment-out-multiple-lines-using-vim?utm_source=feedburner&utm_medium=twitter&utm_campaign=Feed%3A+linuxask+%28Linux+Ask%21%29



Comment out multiple lines using vim
Answer:
When you want to comment out multiple lines in a configuration file or a program script, it is easy with the help of vim.
Steps:
1. Change to command mode
2. Enable visual block editing by pressing Ctrl + V
3. Select the line(s)
4. Press "I", enter the character you needed, e.g. "#"
5. Press "Esc", then "Enter"

2014年6月24日 星期二

Warning: Backslash and Newline separated by space

Warning: Backslash and Newline separated by space

Solution: The backslash (\) character is used as the continuation character to continue #define statements and strings to the next line. GCC expects the backslash character to be the very last character on the line. This warning indicates that there is a space after the backslash. Delete the space and any other characters that come after the backslash

2014年6月22日 星期日

How to quickly compile FFmpeg with libx264 (x264, H.264)

  1. Compile x264. See How to quickly compile libx264 for instructions.
In order to quickly compile your libx264, you can type the following commands in your shell:
# cd /my/path/where/i/keep/compiled/stuff
# git clone git://git.videolan.org/x264.git
# cd x264
# ./configure --enable-static --enable-shared
# make
# make install
# ldconfig
If you get a message like this:
Found yasm 0.x.x.xxxx
Minimum version is yasm-1.0.0
If you really want to compile without asm, configure with --disable-asm.
that means that you have an old version of yasm on your system, so you should update it. The quickest way to do so is like this:
# git clone git://github.com/yasm/yasm.git
# cd yasm
# ./autogen.sh
# ./configure
# make
# make install
and after that, just repeat the configuremake, and make install steps for libx264 and it should be fine this time.

  1. Compile FFmpeg:
    # cd /my/path/where/i/keep/compiled/stuff
    # git clone git://source.ffmpeg.org/ffmpeg.git
    # cd ffmpeg
    # ./configure --enable-gpl --enable-libx264
    # make
    # make install
    # ldconfig

2014年4月22日 星期二

Shared folders will not mount after 3.10 update

https://forums.virtualbox.org/viewtopic.php?f=3&p=283645

Q:
I installed the VirtualBox-4.3.10-93012-Win.exe update today.

My Ubuntu VM booted OK and worked normally, but then I got the prompt to update the guest additions. After doing that and rebooting I cannot mount shared folders. I get this error:
mount: wrong fs type, bad option, bad superblock on /home/richard/Xdata,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

and in dmesg I see 
sf_read_super_aux err=-22
I tried recreating the shared folder but it made no difference.



A:

Debian based machines seem to have changed the location of the install, pointing to location that does not exist.

Look at /sbin/mount.vboxsf and see if the link is broken, and see if the Guest additions are installed in /opt, and if so see below.

The work-a-round is to run the following in a terminal on the guest.

CODE: SELECT ALL   EXPAND VIEW
sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions \
/usr/lib/VBoxGuestAdditions

cscope install Q&A


  • curses : command no found
sudo apt-get install libncurses-dev 

  • flex : command not found
sudo apt-get install flex

  • fscanner.c error 1
  • make: yacc: Command not found

    sudo apt-get install bison
    http://stackoverflow.com/questions/3871425/how-to-install-lex-and-yacc-in-ubuntu

    Installing VirtualBox Guest Additions on Ubuntu Server



    Installing VirtualBox Guest Additions is necessary to enable folder sharing between host and guest operating systems on VirtualBox. This is a quick how-to install the additions from the command line on the Ubuntu Server virtual machine:
    1. Start the Ubuntu Server VM and insert the Guest Additions CD image (Devices menu, Install Guest Additions).
    2. Mount the CD Rom with the shell command:
      $ sudo mount /dev/cdrom /media/cdrom
      
      After that the install scripts should be accessible in the /media/cdrom/ directory:
      $ ls -l /media/cdrom/
      total 41942
      dr-xr-xr-x 3 root root     2048 Dec 19 13:11 32Bit
      dr-xr-xr-x 2 root root     2048 Dec 19 13:11 64Bit
      -r-xr-xr-x 1 root root      647 Aug 16  2011 AUTORUN.INF
      -r-xr-xr-x 1 root root     6966 Dec 19 13:02 autorun.sh
      -r-xr-xr-x 1 root root     5523 Dec 19 13:02 runasroot.sh
      -r-xr-xr-x 1 root root  7361995 Dec 19 13:06 VBoxLinuxAdditions.run
      -r-xr-xr-x 1 root root 14634496 Dec 19 13:08 VBoxSolarisAdditions.pkg
      -r-xr-xr-x 1 root root 13270208 Dec 19 12:55 VBoxWindowsAdditions-amd64.exe
      -r-xr-xr-x 2 root root   278832 Dec 19 12:48 VBoxWindowsAdditions.exe
      -r-xr-xr-x 1 root root  7383936 Dec 19 12:49 VBoxWindowsAdditions-x86.exe
      
    3. Install necessary build tools and build dependencies:
      $ sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
      
      Note
      Getting the headers solves a potential build error that is reported in /var/log/vboxadd-install.log
      Failed to install using DKMS, attempting to install without
      /tmp/vbox.0/Makefile.include.header:94: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop.
      
    4. Build and install the Guest Additions:
      $ sudo /media/cdrom/VBoxLinuxAdditions.run
      
    Tested on Ubuntu Server 12.04 precisely.

    change resolution of virtualbox

    1. virtualbox 4.3.10 , Debian7.4(none desktop environment)

    2. update grub to grub2

    sudo apt-get install grub-pc

    sudo upgrade-from-grub-legacy

    3. Getting resolution from GRUB2.
        At grub menu list type "c" into command and input "vbeinfo" than you can get all resolution     providing by graphic card.
    ex:1280x1024x16,800x600x24,640x480.....

    3.modify /etc/default/grub


    • GRUB_GFXMODE=1024x768x8

    1024x768x8 => this value is got from Step 3.


    • GRUB_GFXPAYLOAD_LINUX=keep


    GRUB_GFXPAYLOAD_LINUX will work with  GRUB_GFXMODE.
    It wil let kernel have the same resoluiton with GRUB2.

    4.running sudo update-grub afterwards to update.

    http://wiki.ubuntu-tw.org/index.php?title=GRUB2%E4%B8%AD%E6%96%87%E6%8C%87%E5%8D%97%E7%AC%AC%E4%BA%8C%E7%89%88(%E4%B8%8A%EF%BC%89

    ps:
    If  want to get more resolution setting vale , you can use followed command.

    VBoxManage setextradata global GUI/MaxGuestResolution any
    VBoxManage setextradata "VM name" "CustomVideoMode1" "1280x800x32"

    http://chimerhapsody.blogspot.tw/2013/07/virtualbox-virtualbox-customize-screen.html

    2014年4月21日 星期一

    Add User to “sudoers” File

    from:http://benaiah41.wordpress.com/2008/08/15/37/
    To give a user the ability to use the “sudo” command you must add them to the “sudoers” file.  Here’s how.
    Thanks to ubuntucat (see comment below) for the following suggestion!  The easiest way to allow a user to sudo is to simply run the following command from the Terminal:
    To open the Terminal:
    Applications >> Accessories >> Terminal
    Once the Terminal is open type:
    sudo adduser username admin
    This must be done from an account that already has sudo abilities or else from the root account.
    If for some reason you have to manually edit the “sudoers” file keep reading!
    Open the file “sudoers” located at /etc/sudoers using your favorite text editor.  You must have root permissions to be able to edit this file so you will want to open your editor from the command line.
    To use gedit you would do the following:
    Open the Terminal and type:
    sudo gedit /etc/sudoers
    If you want to use vim you can simply enter the following into the Terminal:
    sudo visudo
    Once you have the sudoers file open, scroll down to the line:
    root   ALL = (ALL)    ALL
    Add the folling line below the root line (replacing “user” with the name of the account you wish to give sudo access to)
    user   ALL = (ALL)    ALL
    Save and close the file.  The new user has now been added to the “sudoers” file and can use the “sudo” command.

    2014年3月19日 星期三

    Rapberry+ffmpeg+openmax+x264 cross complier at debian 7.1 issue

    今天cross complier 出現下列錯誤,

    1.

    /libavcodec.a(iirfilter.o): undefined reference to symbol 'tan@@GLIBC_2.4'

    解決方案:

    在Makefile 加上-lm


    2.

    lib/libx264.a(opencl.o): undefined reference to symbol 'dlsym@@GLIBC_2.4'
    lib/arm-linux-gnueabihf/libdl.so.2: error adding symbols: DSO missing from command line

    解決方案:

    在Makefile 加上-ldl

    3.

    /home/frank/ffmpeg/libavfilter/vf_pp.c:132: undefined reference to `pp_postprocess'
    /home/frank/hpbProject/ffmpeg_RPi/rpi_app/opt/ffmpeg_RPi/stuff/lib/libavfilter.a(vf_pp.o): In function `pp_config_props':
    /home/frank/ffmpeg/libavfilter/vf_pp.c:105: undefined reference to `pp_get_context'
    /home/frank/hpbProject/ffmpeg_RPi/rpi_app/opt/ffmpeg_RPi/stuff/lib/libavfilter.a(vf_pp.o): In function `pp_uninit':
    /home/frank/ffmpeg/libavfilter/vf_pp.c:151: undefined reference to `pp_free_mode'
    /home/frank/ffmpeg/libavfilter/vf_pp.c:153: undefined reference to `pp_free_context'
    /home/frank/hpbProject/ffmpeg_RPi/rpi_app/opt/ffmpeg_RPi/stuff/lib/libavfilter.a(vf_pp.o): In function `pp_init':
    /home/frank/ffmpeg/libavfilter/vf_pp.c:56: undefined reference to `pp_get_mode_by_name_and_quality'
    collect2: error: ld returned 1 exit status

    解決方案:

    在Makefile 加上-ldl

    載入載入libb有順序要求

    -L$(FFMPEG_DIR)/lib -lpostproc -lavcodec -lavdevice -lavfilter -lavformat -lavuti    l -lswresample -lswscale -lx264

    from:
    http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2012-July/127433.html

    Le quartidi 24 messidor, an CCXX, Chau Pham a écrit :
    > LIBS = -lpostproc -lswresample -lswscale -lavfilter -lavdevice -lavformat -lavcodec -lavutil -lm -ldl -Wl
    
    Since you are about tu use static libraries (you did not put --enable-shared
    and the error messages show .a files), the -l options must be in dependency
    order. For example, libavfilter uses libswresample and libswscale and is
    used by libavdevice, so -lavfilter must come after -lavdevice but before
    -lswscale and -lswresample. You need also to explicitly add the few system
    libraries ffmpeg depends on in its default build; you already added -lm and
    -ldl, but you probably need also libz, and possibly the ALSA, SDL, JACK,
    etc., libraries, depending on what configure has found.
    
    Regards,
    
    -- 
      Nicolas George
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 198 bytes
    Desc: Digital signature
    URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120711/0344cab9/attachment.asc>