useful ffmpeg commands

Getting infos from a video file

ffmpeg -i video.avi

Basic Convert

ffmpeg -i video_origine.extension video_finale.extension

Turn X images to a video sequence

ffmpeg -f image2 -i image%d.jpg video.mpg

Turn a video to X images

ffmpeg -i video.mpg image%d.jpg

Encode a video sequence for the iPpod/iPhone

ffmpeg -i source_video.avi input -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 320×180 -title X final_video.mp4

Explanations :
Source : source_video.avi
Audio codec : aac
Audio bitrate : 128kb/s
Video codec : mpeg4
Video bitrate : 1200kb/s
Video size : 320px par 180px
Generated video : final_video.mp4

Extracting sound from a video, and save it as Mp3

ffmpeg -i source_video.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 sound.mp3

Explanations :
Source video : source_video.avi
Audio bitrate : 192kb/s
output format : mp3
Generated sound : sound.mp3

Convert a wav file to Mp3

ffmpeg -i son_origine.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 son_final.mp3

Mix a video with a sound file

ffmpeg -i son.wav -i video_origine.avi video_finale.mpg


Basic Syntax

ffmpeg -i input output

ffmpeg -i audio.mp3 audio.wav
ffmpeg -i video.mp4 video.mkv
ffmpeg -i video.mp4 audio.wav

Specifying Video and Audio codecs

ffmpeg -codecs
ffmpeg -formats

ffmpeg -i input.wav -c:a libfaac output.mp4
ffmpeg -i input.avi -c:v libx264 -c:a libfaac output.mkv

When to copy, when to encode?
The following command is wrong: It will re-encode your video

ffmpeg -i input.mp4 output.mkv

This command however does it right:

ffmpeg -i input.mp4 -c:v copy -c:a copy output.mkv

If changing the container without encoding does not work for you, you can try the mkvmerge

mkvmerge input.avi -o output.mkv


join ts files
Create a file mylist.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored):

# this is a comment
file ‘/path/to/file1’
file ‘/path/to/file2’
file ‘/path/to/file3’

Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files:

ffmpeg -f concat -i mylist.txt -c copy output.extension


ffmpeg -f concat -i mylist.txt output.extension


Answer:How to edit a binary file’s hex value using C#

Position Value
——– ——
0 0x4D
1 0x5A
2 0x90
4 0x03
8 0x04
12 0xFF
13 0xFF
16 0xB8
24 0x40

using (var stream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite)) {
stream.Position = 24;


Answer:Iterate two Lists or Arrays with one ForEach statement in C#

var numbers = new [] { 1, 2, 3, 4 };
var words = new [] { “one”, “two”, “three”, “four” };

var numbersAndWords = numbers.Zip(words, (n, w) => new { Number = n, Word = w });
foreach(var nw in numbersAndWords)
Console.WriteLine(nw.Number + nw.Word);


Answer:How do I find vulnerabilities in software?


First you need to choose a platform and a piece of software to attack. To begin I would choose something that is open source. There are several advantages to this; the main one being that you can look at the source code. You then need to pick an aspect that you would like to attack. For example, maybe you want to attack the UDP implementation of the Linux networking stack.

Performing an analysis on a closed source piece of software means you’re disassembling the binary, rooting through instructions, and debugging the process. This is long and tedious. Better to get a grasp as to what breaks code with source code before you go looking for it in disassembly.

By being specific in your target allows you to systematically analyze a piece of software.


With your target in mind begin your analysis of the portion of the software you want to find vulnerabilities.

  • Determine which source code files affect your target.
  • With open source you can insert debug messages to ensure you understand the code flow. This can be extremely important. Knowing what sections of code are called, and the variables that lead to that outcome is key in understanding what is going on.
  • Run code analysis tools over the project. Depending on the project this might be a moot point, but they can be handy and catch common programming errors.
  • Enable all of the compiler build flags. Your goal is to find programming errors. What better way than to have the compiler tell you where it thinks the code is bad.

These are just a few of the things you can do to analyze the software. Build a list of possible coding errors.


Now with a list of possible coding flaws you need to determine if you can trigger them. Again, debug messages will help you. Go back to the source code and determine what exactly needs to happen for each coding flaw to break the software. You’re not looking for full exploitation, you just want the code to crash, or do something unexpected. You need to determine what could trigger a coding flaw. This could be anything from affecting a length variable, tricking a function to take a path to process data incorrectly, etc. Some coding flaws just aren’t triggerable, but that’s the nature of vulnerability analysis.

At this point you have a list of flaws, and a list of ideas for each flaw on what might trigger it to do something unexpected.


Now you write code. Using pretty much whatever programming language is convenient for the software you’re attacking. You could write Python code to throw specific packets at network devices to attempt to take down the UDP implementation of a Linux based device.

The goal is to implement your triggers, and hope that the code works the way you think. Your debug messages will be helpful here.

  • They can tell you if the code path taken is abnormal.
  • They can show you variables that you’re attempting to manipulate
  • They ensure that your trigger is doing what you expect, and you can adjust it accordingly.

With any luck you’re able to cause something different to happen. Maybe that can lead to code execution, maybe not. That’s a horse of a different color.


Vulnerability analysis takes time. A lot of time. You’re not going to spend a day analyzing software and find 10 vulnerabilities. The unofficial average for vulnerability analysis is 1 vulnerability per 3 months of analysis. You can double that time if you’re analyzing a non-open source project.

via @RoraΖ :

How to fix – We were unable to find a vhost with a ServerName or Address [ssl]

creating a configuration file symbolic link

sudo ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/000-default-ssl.conf

Enable SSL for apache server in 5 minutes

add this to 000-default-le-ssl.conf


How to Disable Apache Web Server Signature

On Debian, Ubuntu or Linux Mint:

sudo vi /etc/apache2/apache2.conf

On CentOS, Fedora, RHEL or Arch Linux:

sudo vi /etc/httpd/conf/httpd.conf

Add the following two lines at the end of Apache config file.

ServerSignature Off

ServerTokens Prod

Then restart web server to activate the change:

sudo service apache2 restart (Debian, Ubuntu or Linux Mint)

sudo service httpd restart (CentOS/RHEL 6)

sudo systemctl restart httpd.service (Fedora, CentOS/RHEL 7, Arch Linux)

(see image from source url)

ps: ServerTokens can be set to:

Prod (Server: Apache)
Min (Server: Apache/1.3.0)
OS (Server: Apache/1.3.0 (Unix))

Full (Apache/1.3.0 (Unix) PHP/3.0 MyMod/1.2)

How to disable (apache’s) server signature

How to Install LAMP on Ubuntu / Debian

1. Install Apache

sudo apt-get install apache2

2. Install MySQL

sudo apt-get install mysql-server

3. Install PHP

sudo apt-get install php5 libapache2-mod-php5

4. Restart Server

sudo /etc/init.d/apache2 restart

ps: After installation of phpMyAdmin it creates a configuration file for Apache2. Edit Apache2 main configuration file /etc/apache2/apache2.conf

vi /etc/apache2/apache2.conf

add following line at the end of file.

Include /etc/phpmyadmin/apache.conf

Restart Server

sudo /etc/init.d/apache2 restart

How to Install and Configure phpMyAdmin on Ubuntu 18.04 & 16.04 LTS

How to reset or change the MySQL root password

1. Stop the MySQL Server.

sudo /etc/init.d/mysql stop

2. Start the mysqld configuration.

sudo mysqld –skip-grant-tables &

3. Login to MySQL as root.

mysql -u root mysql

4. Replace YOURNEWPASSWORD with your new password!


How to fix : ImportError: cannot import name ‘IncompleteRead’ [Python]

First remove the package from the package manager:

apt-get remove python-pip

And then install the latest version by side:

easy_install pip

how to install docker with apt-get

Instead of using docker use
sudo apt-get install

Why install docker on ubuntu should be `sudo apt-get install`?
Ans =
Why do Ubuntu use as executable name instead of just docker? Tutorials, blog posts all now have to mention this difference, “if you use Ubuntu 14.04, or if you are with rest of the world (including earlier versions of Ubuntu)”. Why?

This is because of a Debian/Ubuntu policy; there is already a program called “docker” [1], and it was not allowed to use the same binary name.