2016-01-10

Changing frame rate and frame size using avconv


To get info abaut video file content:
$ avprobe <file>

* .mp4 files


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './video_fps60.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.19.100
  Duration: 01:41:19.63, start: 0.000000, bitrate: 4427 kb/s
    Stream #0.0(und): Video: h264 (Main), yuv420p, 1280x720, 4285 kb/s, 59.94 fps, 90k tbn, 119.88 tbc
    Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, fltp, 125 kb/s

Did not allow keep aac audio codec:
encoder 'aac' is experimental and might produce bad results.
Add '-strict experimental' if you want to use it.

So I change it to ac3, set 2 audio chanels and 4 threads cause my CPU i5, I have 4 cores available:

$ avconv -i video_fps60.mp4 -threads 4 -r 24 -acodec ac3 -ac 2 video_fps24.mp4

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './video_fps24.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.20.4
  Duration: 00:01:24.33, start: 0.000000, bitrate: 3246 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720, 3053 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc
    Stream #0.1(eng): Audio: ac3, 44100 Hz, stereo, fltp, 191 kb/s


* .mkv files


Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> libvorbis)
  Stream #0:2 -> #0:2 (? -> ass)
Error while opening encoder for output stream #0:2 - maybe incorrect parameters such as bit_rate, rate, width or height

First stream is video, second audio, I don't event know what the third stream is, i guess i don't need it. So I use map, to specify only streams I want to include.

$ avconv -i video_fps60.mkv -map 0:0 -map 0:1 -threads 4 -r 30 video_fps24.mkv

$ avconv -i video_fps60.mkv -map 0:0 -map 0:1 -s 480x800 -threads 4 -r 24 video_fps24.mkv

From 4.3 GB file I get  3.6 GB (30 fps ) and  1.9 GB (480x800 and 24 fps).

To see all supported codecs
$ avconv -codecs













2015-12-12

Tox chat


For me it's amazing Christmas gift from Open Source!


Quote: 

"A New Kind of Instant Messaging

With the rise of government monitoring programs, Tox provides an easy to use application that allows you to connect with friends and family without anyone else listening in. While other big-name services require you to pay for features, Tox is totally free and comes without advertising."

https://tox.chat/

https://github.com/tux3/qTox

This is what I really subscribe for! Thank you!


2015-10-12

Qt: Dynamic Copy File in the Thread example, requires Wraparound class


  • Wraparound class


ThreadCopyFile::ThreadCopyFile(QObject *parent) : QObject(parent)
{
    qDebug() << this << "Created";

    this->v_thread = new QThread();
    this->v_copyFile = new CopyFile();
     

    connect(v_thread,SIGNAL(started()),v_copyFile,SLOT(Copy()));
    connect(v_copyFile,SIGNAL(done()),v_thread,SLOT(quit()));
    connect(v_thread,SIGNAL(finished()),this,SLOT(finished()));

    this->v_copyFile->moveToThread(this->v_thread);
    this->v_thread->start();

}

ThreadCopyFile::~ThreadCopyFile()
{
    delete this->v_thread;
    delete this->v_copyFile;
}

public slots:


void ThreadCopyFile::finished()
{
    qDebug() << this << "Finished";
    this->~ThreadCopyFile();
    qDebug() << this << "Destroyed";
}



  • Class for actual work


CopyFile::CopyFile(QObject *parent) : QObject(parent)
{
    qDebug() << this << "Created";


}

CopyFile::~CopyFile()
{
    qDebug() << this << "Destroyed";
}


signals:


    void done();

public slots:

void CopyFile::Copy(void)
{

    QString src = "/media/data/torrent/linuxmint-17.2-mate-32bit.iso";
    QString dst = "/tmp/linuxmint-17.2-mate-32bit.iso";

    if(QFile::exists(dst))
    {

        qDebug() << "file exists";

        if(QFile::remove(dst))
        {
            qDebug() << "Files removed";
        }
        else
        {
            qDebug() << "Files  fail to remove";
        }
    }

    qDebug() << "Copy File started";

    if(QFile::copy(src,dst))
    {
        qDebug() << "Copy File finished";
    }
    else
    {
        qDebug() << "Copy File fail";
    }

    emit done();
}



UI runs on other thread, everything work nicely :)


2015-10-10

Update Linux Kernel on Mint or Ubuntu


for upgrade you need three packages, depending on you architecture:

linux-headers ... ... ... amd64.deb
linux-headers ... ... ... all.deb
linux-image   ... ... ... amd64.deb

if you use Ubuntu based Linux distro, you can pick one of these: 


for example:

$ sudo update-grub


If for some reason you want to downgrade the kernel, it loads the newest kernel by default, so just uninstall new one (three packages that I mentioned) and it will load second on the list after reboot. Make sure you have at least one kernel installed! :)




2015-10-02

GIT ANNEX on RASPBIAN JESSIE

https://github.com/tradloff/git-annex-RPi

Problem:

git-annex: error while loading shared libraries: libgnutls.so.26: cannot open shared object file: No such file or directory
fatal: 'annex' appears to be a git command, but we were not
able to execute it. Maybe git-annex is broken?

Solution:

sudo ln -s /usr/lib/arm-linux-gnueabihf/libgnutls.so /usr/lib/arm-linux-gnueabihf/libgnutls.so.26