Rechercher dans ce blog

jeudi 24 décembre 2015

mysql check database & repair table


Pour réparer une table signalée en erreur  comme :


mysqld: 151224 12:10:27 [ERROR] /usr/sbin/mysqld: Table './metar_2013/M05_error' is marked as crashed and should be repaired

Utiliser la commande mysql

repair table nombase.nomtable;


mysqlcheck — A Database Maintenance Program


shell> mysqlcheck [options] db_name [tbl_name ...]
shell> mysqlcheck [options] --databases db_name ...
shell> mysqlcheck [options] --all-databases




The names shown in the following table can be used to change mysqlcheck default behavior.
CommandMeaning
mysqlrepairThe default option is --repair
mysqlanalyzeThe default option is --analyze
mysqloptimizeThe default option is --optimize


mysqlrepair:   The default option will be -r
mysqlanalyze:  The default option will be -a
mysqloptimize: The default option will be -o

Usage: mysqlcheck [OPTIONS] database [tables]
OR     mysqlcheck [OPTIONS] --databases DB1 [DB2 DB3...]
OR     mysqlcheck [OPTIONS] --all-databases

Default options are read from the following files in the given order:
/etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
The following groups are read: mysqlcheck client
The following options may be given as the first argument:
--print-defaults    Print the program argument list and exit
--no-defaults        Don't read default options from any options file
--defaults-file=#    Only read default options from the given file #
--defaults-extra-file=# Read this file after the global files are read
  -A, --all-databases Check all the databases. This will be same as
                      --databases with all databases selected.
  -a, --analyze       Analyze given tables.
  -1, --all-in-1      Instead of issuing one query for each table, use one
                      query per database, naming all tables in the database in
                      a comma-separated list.
  --auto-repair       If a checked table is corrupted, automatically fix it.
                      Repairing will be done after all tables have been
                      checked, if corrupted ones were found.
  --character-sets-dir=name
                      Directory where character sets are.
  -c, --check         Check table for errors.
  -C, --check-only-changed
                      Check only tables that have changed since last check or
                      haven't been closed properly.
  -g, --check-upgrade Check tables for version-dependent changes. May be used
                      with --auto-repair to correct tables requiring
                      version-dependent updates.
  --compress          Use compression in server/client protocol.
  -B, --databases     To check several databases. Note the difference in usage;
                      In this case no tables are given. All name arguments are
                      regarded as databasenames.
  -#, --debug[=#]     This is a non-debug version. Catch this and exit.
  --default-character-set=name
                      Set the default character set.
  -F, --fast          Check only tables that haven't been closed properly.
  -f, --force         Continue even if we get an sql-error.
  -e, --extended      If you are using this option with CHECK TABLE, it will
                      ensure that the table is 100 percent consistent, but will
                      take a long time. If you are using this option with
                      REPAIR TABLE, it will force using old slow repair with
                      keycache method, instead of much faster repair by
                      sorting.
  -?, --help          Display this help message and exit.
  -h, --host=name     Connect to host.
  -m, --medium-check  Faster than extended-check, but only finds 99.99 percent
                      of all errors. Should be good enough for most cases.
  -o, --optimize      Optimize table.
  -p, --password[=name]
                      Password to use when connecting to server. If password is
                      not given it's solicited on the tty.
  -P, --port=#        Port number to use for connection or 0 for default to, in
                      order of preference, my.cnf, $MYSQL_TCP_PORT,
                      /etc/services, built-in default (3306).
  --protocol=name     The protocol of connection (tcp,socket,pipe,memory).
  -q, --quick         If you are using this option with CHECK TABLE, it
                      prevents the check from scanning the rows to check for
                      wrong links. This is the fastest check. If you are using
                      this option with REPAIR TABLE, it will try to repair only
                      the index tree. This is the fastest repair method for a
                      table.
  -r, --repair        Can fix almost anything except unique keys that aren't
                      unique.
  -s, --silent        Print only error messages.
  -S, --socket=name   Socket file to use for connection.
  --ssl               Enable SSL for connection (automatically enabled with
                      other flags). Disable with --skip-ssl.
  --ssl-ca=name       CA file in PEM format (check OpenSSL docs, implies
                      --ssl).
  --ssl-capath=name   CA directory (check OpenSSL docs, implies --ssl).
  --ssl-cert=name     X509 cert in PEM format (implies --ssl).
  --ssl-cipher=name   SSL cipher to use (implies --ssl).
  --ssl-key=name      X509 key in PEM format (implies --ssl).
  --ssl-verify-server-cert
                      Verify server's "Common Name" in its cert against
                      hostname used when connecting. This option is disabled by
                      default.
  --tables            Overrides option --databases (-B).
  --use-frm           When used with REPAIR, get table structure from .frm
                      file, so the table can be repaired even if .MYI header is
                      corrupted.
  -u, --user=name     User for login if not current user.
  -v, --verbose       Print info about the various stages.
  -V, --version       Output version information and exit.
 

mardi 15 décembre 2015

Verify & Repair Permissions in OS X El Capitan via command line

To verify


sudo /usr/libexec/repair_packages --verify --standard-pkgs /

To repair


sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /

Finalisation installation EL CAPITAN os x 10.11

- Remove Apple HD Recovery


En mergeant la partition via diskutil  mergePartitions

J'ai l'impression que la réactivité est meilleure depuis que j'ai réduis au minimum le nombre de partitions sur le disque et notamment en supprimant les partitions de recovery. A confirmer et éventuellement obtenir une explication logique à cela



Pour lister tous les services chargés :

launchctl list

launchctl print-disabled system 

Pour lister les services system disabled à true


enable | disable service-target
              Enables or disables the service in the requested domain. Once a service is disabled, it cannot be loaded in the specified domain until it is once
              again enabled. This state persists across boots of the device. This subcommand may only target services within the system domain or user and
              user-login domains.


list [-x] [label]
              With no arguments, list all of the jobs loaded into launchd in three columns. The first column displays the PID of the job if it is running.  The
              second column displays the last exit status of the job. If the number in this column is negative, it represents the negative of the signal which
              stopped the job. Thus, "-15" would indicate that the job was terminated with SIGTERM.  The third column is the job's label. If [label] is speci-
              fied, prints information about the requested job.

              -x       This flag is no longer supported.

print-disabled
              Prints the list of disabled services.

blame service-target
              If the service is running, prints a human-readable string describing why launchd launched the service. Note that services may run for many rea-
              sons; this subcommand will only show the most proximate reason. So if a service was run due to a timer firing, this subcommand will print that
              reason, irrespective of whether there were messages waiting on the service's various endpoints. This subcommand is only intended for debugging
              and profiling use and its output should not be relied upon in production scenarios.

     print domain-target | service-target
              Prints information about the specified service or domain. Domain output includes various properties about the domain as well as a list of ser-
              vices and endpoints in the domain with state pertaining to each. Service output includes various properties of the service, including information
              about its origin on-disk, its current state, execution context, and last exit status.

              IMPORTANT: This output is NOT API in any sense at all. Do NOT rely on the structure or information emitted for ANY reason. It may change from
              release to release without warning.

load | unload [-wF] [-S sessiontype] [-D domain] paths ...
              Load the specified configuration files or directories of configuration files.  Jobs that are not on-demand will be started as soon as possible.
              All specified jobs will be loaded before any of them are allowed to start. Note that per-user configuration files (LaunchAgents) must be owned by
              root (if they are located in /Library/LaunchAgents) or the user loading them (if they are located in $HOME/Library/LaunchAgents).  All system-
              wide daemons (LaunchDaemons) must be owned by root. Configuration files must disallow group and world writes. These restrictions are in place for
              security reasons, as allowing writability to a launchd configuration file allows one to specify which executable will be launched.

              Note that allowing non-root write access to the /System/Library/LaunchDaemons directory WILL render your system unbootable.

              -w       Overrides the Disabled key and sets it to false or true for the load and unload subcommands respectively. In previous versions, this
                       option would modify the configuration file. Now the state of the Disabled key is stored elsewhere on- disk in a location that may not be
                       directly manipulated by any process other than launchd.

              -F       Force the loading or unloading of the plist. Ignore the Disabled key.

              -S sessiontype
                       Some jobs only make sense in certain contexts. This flag instructs launchctl to look for jobs in a different location when using the -D
                       flag, and allows launchctl to restrict which jobs are loaded into which session types. Sessions are only relevant for per-user launchd
                       contexts. Relevant sessions are Aqua (the default), Background and LoginWindow.  Background agents may be loaded independently of a GUI
                       login. Aqua agents are loaded only when a user has logged in at the GUI. LoginWindow agents are loaded when the LoginWindow UI is dis-
                       playing and currently run as root.

              -D domain
                       Look for plist(5) files ending in *.plist in the domain given. This option may be thoughts of as expanding into many individual paths
                       depending on the domain name given. Valid domains include "system," "local," "network" and "all." When providing a session type, an
                       additional domain is available for use called "user." For example, without a session type given, "-D system" would load from or unload
                       property list files from /System/Library/LaunchDaemons.  With a session type passed, it would load from /System/Library/LaunchAgents.
                       Note that launchctl no longer respects the network domain.

              NOTE: Due to bugs in the previous implementation and long-standing client expectations around those bugs, the load and unload subcommands will
              only return a non-zero exit code due to improper usage.  Otherwise, zero is always returned.

- Turn off / Disable Apple Push Notifications

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist


Bloqué avec littlesnitch

- com.apple.Safari.SafeBrowsing.Service

Bloqué avec littlesnitch

From http://www.sitepronews.com/2014/10/01/googles-safe-browsing-service-killing-privacy/

Google Safe Browsing is a service through which Google provides lists of URLs (addresses) of websites that contain malware or phishing content. These lists of suspicious sites are continuously updated using Google’s web crawlers, programs that scour the web to index sites for Google’s search engine. Lists from the Google Safe Browsing service are used by browsers such as Google Chrome, Mozilla Firefox and apple Safari for checking web-pages users are trying to access against potential threats. The service issues alerts when they are about to open websites or content Google has classified as malicious. The warnings are display as ‘visual messages’ along with specific details relating to the malicious content concerned. The service is also designed to block the downloading of files infected with malware and, once a user’s computer has been infected, it can issue instructions on how to detect and remove the malware.

...


The Firefox and Safari browsers however use a second version of the API, Safe Browsing API v2, to exchange data with the server. This uses hashed URLs so the Google server never knows the actual URLs queried by the user. However the Safe Browsing API also stores a cookie on the user’s computer which the NSA (US National Security Agency) uses to identify individual computers. This is a mandatory requirement that many users feel is acceptable as it helps them feel safe. In addition, Google stores another cookie on the user’s computer that can be used to identify the IP addresses the user visits, ie can be used to track him or her. Google’s excuse is that the tracking cookie logs this data in order to prevent DDoS (distributed denial-of-service) attacks. That may be so. The API in the user’s browser (eg, Chrome) will ‘phone home’ every few hours to check for updates to its list of malicious sites. At the same time it sends a payload that includes the machine’s ID and the user’s ID.

Peut être activé ou désactivé dans les préférences de safari onglet Sécurité. Si la liste n'est pas mise à jour, le service se désactive de lui-même.


IMAgent is an OSX daemon which runs as part of FaceTime.

launchctl unload -w /System/Library/LaunchAgents/com.apple.imagent.plist


launchctl unload -w /System/Library/LaunchAgents/com.apple.icloud.findmydeviced.findmydev
ice-user-agent.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.icloud.fmfd.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.findmymacmessenger.plist

launchctl enable system/com.apple.imagent

launchctl disable system/com.apple.imagent

Little Snitch rules

...

Préférences / Extensions... 

ajuster selon les besoins.






dimanche 13 décembre 2015

Empêcher OS X de monter un volume au démarrage / Prevent OS X to mount a disk at startup

Prevent a partition from mounting in OS X


diskutil info /Volumes/disk-to-not-be-auto-mounted

Get 

Volume UUID:              EADFE3D8-33C0-3D52-8D66-E5EA0748F81D

vi  /etc/fstab


UUID=EADFE3D8-33C0-3D52-8D66-E5EA0748F81D none hfs rw,no auto




vendredi 11 décembre 2015

ffmpeg encode settings mémo


ffmpeg encoding settings memo


To test settings : 

ffplay -i 'in-1920p'-vf "crop=1888:1056:0:0,scale=1280:720"

mac os x aac encoding  ffmpeg gpl

-strict -2 -codec:a aac -b:a 56k

From 720p

To Divx VGA


ffmpeg -i 'in-720p.mov' -c:v libxvid -filter:v crop=in_w-320:in_h,scale=640:480 -qscale:v 4 -ac 1 -codec:a libmp3lame -b:a 64k out-VGA.avi

to Divx 480p


ffmpeg -i 'in-720p.mov' -c:v libxvid -filter:v crop=in_w-200:in_h,scale=720:480 -qscale:v 4 -ac 1 -codec:a libmp3lame -b:a 64k out-480P.avi

to MP4 480p


ffmpeg -i 'in-720p.mov' -codec:v libx264 -preset slow -crf 18 -filter:v crop=in_w-200:in_h,scale=720:480 -ac 1 -codec:a libfdk_aac -b:a 56k out-480p.mp4

(Quality crf 18=high - 23=normal)

to MP4 480p main profile


fmpeg -i 'in-720p.mov' -codec:v libx264 -preset slow -filter:v crop=in_w-200:in_h,scale=720:480 -crf 18 -pix_fmt yuv420p -profile:v main -ac 1 -codec:a libfdk_aac -b:a 56k out-480p.mSap4

From HD 1920p

De 1080p à 720p même format d'image 16/9 : crop inutile.

De 1080p à 480p : crop=1616:1080:0:0

Normalement 1620 car 720/480= 1,5 et 1,5x1080=1620 mais pas divisible par 16. Donc j'arrondis à 1616.

De 1080p à VGA (640x480) : crop=1440:1080:0:0


Attention si crop nécessaire 

Maintient de dar et sar à 1
-aspect 16:9

SAINT JACUT MATIN SOIR

To 720p mp4


bin/ffmpeg28 -i /Users/moi/Desktop/sources\ vues\ backup/2012-09-28\ 07_12_19\ \(id\).mov -codec:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -profile:v main -vf rotate=-1.5*PI/180:bilinear=1,format=yuv420p,crop=1856:1008:48:48,scale=1280:720 -aspect 16:9 -an saint-jacut_1_nosound-nots-720P-H264-aac-crf18-main-yuv420p.mp4

bin/ffmpeg28 -i "/Users/moi/Desktop/sources vues backup/2012-09-28 14_15_01 (id).mov" -codec:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -profile:v main -vf rotate=-1.5*PI/180:bilinear=1,format=yuv420p,crop=1856:1008:48:48,scale=1280:720 -aspect 16:9 -t 05:18:12  -an saint-jacut_2_nosound-nots-720P-H264-aac-crf18-main-yuv420p.mp4

Saint Jacut marée montante

Le crop est calculé pour couper l'image en bas 1056 (pour retirer la barrière), puis à droite pour conserver le rapport h/l selon le format de sortie. Le crop est calculé également pour être divisible par 16

To mp4 720p


ffmpeg -i 'in-1920p.mov' -codec:v libx264 -preset slow -filter:v crop=1888:1056:0:0,scale=1280:720 -crf 18 -pix_fmt yuv420p -profile:v main -ac 1 -codec:a libfdk_aac -b:a 56k out-720p.mp4

To mp4 480p


ffmpeg -i 'in-1920p.mov' -codec:v libx264 -preset slow -filter:v crop=1584:1056:0:0,scale=720:480 -crf 18 -profile:v main -ac 1 -codec:a libfdk_aac -b:a 56k out-480p.mp4

To mp4 480p no audio


ffmpeg -i 'in-1920p.mov' -codec:v libx264 -preset slow -filter:v crop=1584:1056:0:0,scale=720:480 -crf 18 -profile:v main -an out-480p.mp4

To mp4 VGA


ffmpeg -i 'in-1980p.mov' -codec:v libx264 -preset slow -filter:v crop=1408:1056:0:0,scale=640:480 -crf 18  -profile:v main -ac 1 -codec:a libfdk_aac -b:a 56k out-VGA.mp4

To mp4 VGA no audio


ffmpeg -i 'in-1980p.mov' -codec:v libx264 -preset slow -filter:v crop=1408:1056:0:0,scale=640:480 -crf 18  -profile:v main -an out-VGA.mp4

no sound => -an

From HD SONY 1440 to VGA with rotation (machines à laver)


ffmpeg -i '/in-1440.mov' -c:v libxvid -filter:v hflip,vflip,format=yuv420p,scale=640:480 -qscale 4 -ac 1 -codec:a libmp3lame -b:a 64k out-VGA.avi


Méthodes de rotation - ffmpeg options


* rotate=PI:bilinear=0,format=yuv420p

* hflip,vflip,format=yuv420p

* transpose=2,transpose=2,format=yuv420p" -metadata:s:v rotate=0

* cropdetect=24:16:0

Start and End time position to encoding


ffmpeg -i ORIGINALFILE.mp4 -acodec copy -vcodec copy -ss START -t LENGTH OUTFILE.mp4
where START is starting positing in seconds or in format hh:mm:ss LENGTH is the chunk length in seconds or in format hh:mm:ss

So you will need to run this command few times depending on how long your video. If let's say your video is 31 minutes long and you want so split into 15 min chunks here is how you run it:

ffmpeg -i ORIGINALFILE.mp4 -acodec copy -vcodec copy -ss 0 -t 00:15:00 OUTFILE-1.mp4

ffmpeg -i ORIGINALFILE.mp4 -acodec copy -vcodec copy -ss 00:15:00 -t 00:15:00 OUTFILE-2.mp4

Concat demuxer

The concat demuxer was added to FFmpeg 1.1. You can read about it in the documentation.

Instructions

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

----

Constant Rate Factor (CRF) - ffmpeg options profiles...


This method allows the encoder to attempt to achieve a certain output quality for the whole file when output file size is of less importance. This provides maximum compression efficiency with a single pass. Each frame gets the bitrate it needs to keep the requested quality level. The downside is that you can't tell it to get a specific filesize or not go over a specific size or bitrate.

1. Choose a CRF value

The range of the quantizer scale is 0-51: where 0 is lossless, 23 is default, and 51 is worst possible. A lower value is a higher quality and a subjectively sane range is 18-28. Consider 18 to be visually lossless or nearly so: it should look the same or nearly the same as the input but it isn't technically lossless.

The range is exponential, so increasing the CRF value +6 is roughly half the bitrate while -6 is roughly twice the bitrate. General usage is to choose the highest CRF value that still provides an acceptable quality. If the output looks good, then try a higher value and if it looks bad then choose a lower value.

Note: The CRF quantizer scale mentioned on this page only applies to 8-bit x264 (10-bit x264 quantizer scale is 0-63). You can see what you are using by referring to the ffmpeg console output during encoding (yuv420p or similar for 8-bit, and yuv420p10le or similar for 10-bit). 8-bit is more common among distributors.

2. Choose a preset

A preset is a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better compression (compression is quality per filesize). This means that, for example, if you target a certain file size or constant bit rate, you will achieve better quality with a slower preset. Similarly, for constant quality encoding, you will simply save bitrate by choosing a slower preset.

The general guideline is to use the slowest preset that you have patience for. Current presets in descending order of speed are: ultrafast,superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. The default preset is medium. Ignore placebo as it is not useful (see FAQ). You can see a list of current presets with -preset help (see example below), and what settings they apply with x264 --fullhelp.

You can optionally use -tune to change settings based upon the specifics of your input. Current tunings include: film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency. For example, if your input is animation then use the animation tuning, or if you want to preserve grain then use the grain tuning. If you are unsure of what to use or your input does not match any of tunings then omit the -tune option. You can see a list of current tunings with -tune help, and what settings they apply with x264 --fullhelp.

Profiles

Another optional setting is -profile:v which will limit the output to a specific H.264 profile. This can generally be omitted unless the target device only supports a certain profile (see Compatibility). Current profiles include: baseline, main, high, high10, high422, high444. Note that usage of -profile:v is incompatible with lossless encoding.

To list all possible internal preset and tunes:

ffmpeg -f lavfi -i nullsrc -c:v libx264 -preset help -f mp4 -


------------

ffmpeg map option


from : https://trac.ffmpeg.org/wiki/Map

In all following examples, we will use an example input file like this one:
# fmpeg -i input.mkv

ffmpeg version ... Copyright (c) 2000-2012 the FFmpeg developers
...
Input #0, matroska,webm, from 'input.mkv':
  Duration: 01:39:44.02, start: 0.000000, bitrate: 5793 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x800, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(ger): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s (default)
    Stream #0:2(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s
    Stream #0:3(ger): Subtitle: text (default)
At least one output file must be specified

#

Example 1

Now, let's say we want to:
  • copy video stream
  • encode german audio stream to mp3 (128kbps) and aac (96kbps) (creating 2 audio streams in the output)
  • drop english audio stream
  • copy subtitle stream
This can be done using the following FFmpeg command line:
ffmpeg -i input.mkv \
    -map 0:0 -map 0:1 -map 0:1 -map 0:3 \
    -c:v copy \
    -c:a:0 libmp3lame -b:a:0 128k \
    -c:a:1 libfaac -b:a:1 96k \
    -c:s copy \
    output.mkv
Note there is no "-map 0:2" and that "-map 0:1" has been specified twice.
Using "-map 0:0 -map 0:1 -map 0:1 -map 0:3" we told FFmpeg to select/map specified input streams to output in that order.
So, our output will now have the following streams:
Output #0, matroska, to 'output.mkv':
    Stream #0:0(eng): Video ...
    Stream #0:1(ger): Audio ...
    Stream #0:2(ger): Audio ...
    Stream #0:3(ger): Subtitle ...
After we selected which streams we would like in our output, using "-map" option, we specified codecs for each stream in our output.
Video and subtitle stream have just been copied and german audio stream has been encoded to 2 new audio streams, mp3 and aac.
We used "-c:a:0" to specify codec for the output's first AUDIO stream and "-c:a:1" to specify codec for the output's second AUDIO stream.
Note that "a:0" refers to the output's first AUDIO stream (#0:1 in our case), "a:1" refers to the output's 2nd AUDIO stream (#0:2 in our case), etc.
The result will be:
Output #0, matroska, to 'output.mkv':
    Stream #0:0(eng): Video ...
    Stream #0:1(ger): Audio ...
    Stream #0:2(ger): Audio ...
    Stream #0:3(ger): Subtitle ...
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (dca -> libmp3lame)
  Stream #0:2 -> #0:2 (dca -> libfaac)
  Stream #0:3 -> #0:3 (copy)

Example 2

Let's say that we want to reorder input streams backwards, so that we have output like this:
    Stream #0:0(ger): Subtitle: text (default)
    Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s
    Stream #0:2(ger): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s (default)
    Stream #0:3(eng): Video: h264 (High), yuv420p, 1920x800, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
This can simply be done using the following command line:
ffmpeg -i input.mkv -map 0:3 -map 0:2 -map 0:1 -map 0:0 -c copy output.mkv
Note that we specified all the input streams, but in the reverse order, which causes that order to be respected in the output.
The option "-c copy" tells FFmpeg to use "copy" on all streams.

Example 3

If we want to extract only audio streams, from input file, then we can do it like this:
ffmpeg -i input.mkv -map 0:1 -map 0:2 -c copy output.mkv

Example 4

If we want to re-encode just the video streams, but copy all the other streams (like audio, subtitles, attachments, etc), we might use something like this:
ffmpeg -i input.mkv -map 0 -c copy -c:v mpeg2video output.mkv
It will tell ffmpeg to:
  • read the input file 'input.mkv'
  • select all the input streams (first input = 0) to be processed (using "-map 0")
  • mark all the streams to be just copied to the output (using "-c copy")
  • mark just the video streams to be re-encoded (using "-c:v mpeg2video")
  • write the output file 'output.mkv'

jeudi 10 décembre 2015

FIX avidemux2 2.5.4 mac os x lion 10.7

To fix crash avidemux 2.5.4 at startup on lion 10.7


Simply delete


in ressource/lib

libxml2.2.dylib
libiconv.2.dylib

mercredi 9 décembre 2015

Commandes Vidéo diverses ffmpeg mencoder avisplit avimerge transcode

How can I fix AVI files with a broken index or bad interleaving?


To avoid having to use -idx to be able to seek in AVI files with a broken index or -ni to play AVI files with bad interleaving, use the command

mencoder -forceidx -nobps  -ovc copy -oac copy -o outidx.avi input.avi

to copy the video and audio streams into a new AVI file while regenerating the index and correctly interleaving the data.

Of course this cannot fix possible bugs in the video and/or audio streams

transcode -i input.avi -P 1 --avi_limit 128 -b 128  -o out.avi

Réaligner chunks vidéo et audio pour qu'il n'y ait pas de désynchronisation après le split


transcode -i input.avi -P1 -N 0x55 -y raw -o out.avi

Split

avisplit -i out.avi -o base -s 512

TOUT EN UNE SEULE OPERATION avec transcode

transcode -i input.avi -P1 -N 0x55 -y raw -o out --avi_limit 512

ffmpeg -threads N


ffmpeg -i input.mp4 -y -threads 2 -map 0.0:0.0 -f avi -vcodec copy -b 940 -aspect 4:3 -s 640x480 -r pal -g 240 -me epzs -qmin 2 -qmax 15 -acodec mp3 -ab 128 -ar 48000 -ac 2 -map 0.1:0.1 -benchmark out.avi

MUXING


mencoder -oac copy -ovc copy  -o output_movie.avi \
    -audiofile input_audio.mp2 input_video.avi

mencoder -of lavf -ovc copy -oac mp3lame -forceidx -lameopts cbr:br=128 -o outmencoder.avi -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames input.mp4

Pour joindre 2 fichiers avi


L'option -c set pour dropper des frames s'il manque de l'audio

avimerge -o bigvideo.avi -c -i avi1 avi2 avi3

launchtl can be used to disable and re-enable crash reporting or mDNSResponder or services mac os x

launchtl can be used to disable and re-enable crash reporting.  


To disable crash  reporting:


           launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
           sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist

     To re-enable crash reporting:

           launchctl load -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
           sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist


Disable mDNSResponder


sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

Disable  Apple Push Notification Service (apsd) on OS X 10.8

launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist


Secret SSH

Secret SSH 



SecretSSH est un petit programme en perl qui permet juste de montrer la
faisabilité d'une idée amusante : cacher sshd et l'activer à distance à
la demande.

Il permet de répondre à ma manière aux personnes qui ont peur du
débordement de buffer ou de la trappe dans un serveur SSH ;-)

L'activation de sshd se fait sur la réception d'un paquet TCP possédant des
caractéristiques particulières. Ainsi, le démon sshd n'est pas toujours en
écoute sur le réseau et à distance il est impossible (?) de le trouver.

Il est possible d'envisager un tel programme pour administrer une machine
aidant à la détection d'intrusion avec SNORT par exemple. Il est alors
possible de fermer tous les services sur cette machine même le port 22/tcp.

Le programme suivant n'est qu'une illustration permettant de montrer ce qui
est faisable mais il est fourni sans aucune garantie.

Pour tester secretssh (fourni ci-dessous) :

. Sur le serveur (en tant que root) : ./secretssh.pl

. Sur le client (en tant que root) : ./secretssh.pl [login@]server

secretssh nécessite perl RawIP qui peut être téléchargé à l'adresse :
http://quake.skif.net/RawIP/files/Net-RawIP-0.09c.tar.gz

Dans la configuration initiale, le client envoi un paquet SYN tcp sur le
port 80 du serveur avec le champ id, l'adresse ip source, le port source et
le numéro de séquence fixés à certaines valeurs. A la réception de ce paquet
le serveur lance sshd en mode debug sur le port 2222/tcp. Le client se connecte
ensuite via ssh sur le port 2222/tcp du serveur. Ce port n'est accessible sur
le serveur que pour une seule connexion ssh.


#------------------------------------------------------------------------------
#!/usr/local/bin/perl
# secretssh - sa/hsc

# RawIP homepage: http://quake.skif.net/RawIP/files/Net-RawIP-0.09c.tar.gz
use Net::RawIP;
## CONF (you should edit all these params) #####
my $key_port_dst = '80';
my $key_ip_src = '192.168.66.66';
my $key_port_src = '1666';
my $key_ip_id = '666';
my $key_tcp_seq = '66666666';
my $verbose = 0;
my $bindport = 2222;
my $SSH = '/usr/local/bin/ssh';
my $SSHD = '/usr/local/sbin/sshd';
## MAIN ########################################
print " --== Secret SSH - sa/hsc ==--\n";
$a = new Net::RawIP;
my $remote = shift || "";
if( $remote=~/\S/ ) { #client
my $login="";
if($remote=~/^(\S+@)(\S+)$/) {$login=$1; $remote=$2;}
$a->set({ip=>{id=>$key_ip_id,saddr=>$key_ip_src,daddr =>$remote},
tcp=>{dest=>$key_port_dst,source=>$key_port_src,syn=>1,seq=>$key_tcp_seq}});
$a->send;
$verbose ? exec "$SSH", '-v', '-p', "$bindport", "${login}${remote}"
: exec "$SSH", '-p', "$bindport", "${login}${remote}";
}
else { #server
my $dev = Net::RawIP::lookupdev($tout);
print "Server using $dev and port $bindport ...\n" if($verbose);
$pcap=$a->pcapinit($dev,"tcp and src host $key_ip_src and src port $key_port_src".
" and ip[4:2] = $key_ip_id and ip[24:4] = $key_tcp_seq",1500,30);
loop $pcap,-1,\&Bindsshd,\@a;
}
## FUNC #########################################
sub Bindsshd { system "$SSHD", '-d', '-p', "$bindport"; }
## EOF ##########################################
#------------------------------------------------------------------------------

exemples acl chmod Mac OS X et extended attributs xattr manipulations

Exemples acl chmod Mac OS X et extended attributs xattr manipulations

Examples acl chmod Mac OS X

# ls -le
-rw-r--r--+ 1 juser wheel 0 Apr 28 14:06 file1
# chmod +a "admin allow write" file1
# ls -le
-rw-r--r--+ 1 juser wheel 0 Apr 28 14:06 file1
owner: juser
1: admin allow write
# chmod +a "guest deny read" file1
# ls -le
-rw-r--r--+ 1 juser wheel 0 Apr 28 14:06 file1
owner: juser
1: guest deny read
2: admin allow write
# chmod +a "admin allow delete" file1
# ls -le
-rw-r--r--+ 1 juser wheel 0 Apr 28 14:06 file1
owner: juser
1: guest deny read
2: admin allow write,delete



Use the xattr command. You can inspect the extended attributes:

$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms
com.apple.quarantine
and use the -d option to delete one extended attribute:
$ xattr -d com.apple.quarantine s.7z
$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms
you can also use the -c option to remove all extended attributes:

$ xattr -c s.7z
$ xattr s.7z