Monday, August 21, 2017

smart TV LG évolution du logiciel/plateforme netcast webos linux et des fonctions comme enregistrement sur disque


Comment une société comme LG utilise Linux.
  1. NetCast (noyau linux) is a platform loaded on LG Smart TVs released from 2011 (NetCast 2.0) to 2015 (NetCast 4.5).
  2. webOS TV (noyau linux+PALM+HP) is a platform loaded on LG Smart+ TVs released since 2014.
Benefits of webOS TV, compared with NetCast, are listed  below:
  • Supports multi-tasking
  • Supports key-value based (no-SQL) DB
  • Supports JavaScript service development based on Node.js
  • Supports enhanced HTML5
  • Supports Enyo Framework
http://webostv.developer.lge.com/discover/specifications/webostv-vs-netcast/

WebOS

HP annonce fin 2011 la libération du projet webOS et sa distribution en logiciel libre.
Il est fondé sur linux kernel
https://fr.wikipedia.org/wiki/HP_webOS
https://en.wikipedia.org/wiki/WebOS

netcast

version 4.5 de 2015
OS Linux
CPU ARM Cortex A9 1.2GHz Quad Core
RAM 2 GB
Graphic Resolution 1920X1080 Recommended

Les LG ≥2010 ont une software version = 4.62.12 (aout 2017)
et une version SDK = 2.08; navigateur 5.00.00r5774

Browser Engine

·  Core : Webkit 537.1+ 
·  HTML : HTML 4.1 Supported, HTML 5 Supported Partially
·  XHTML : Supported 
·  DOM : Supported 
·  CSS : CSS 2.1 Supported, CSS 3 Supported Partially 
·  JavaScript : SquirrelFish Extreme 
·  AJAX : Supported 
·  JSON : Supported 
·  Cookie : Supported 
·  userAgent String : Supported

Image Format

·  JPEG : Supported 
·  PNG : Supported 
·  GIF : Supported

NetCast SDK

NetCast SDK 3.0.1 provides tools that help developers to develop the applications for NetCast TV 2013 and later NetCast platforms.
linux/mac/windows

Ref

http://webostv.developer.lge.com/discover/netcast/platform-specifications/

enregistrement émission télé sur disque

voir ce que votre tv a dans le ventre:
apr exemple
http://www.lg.com/fr/televiseurs/lg-42LM640S-tv-lcd-led
USB 2.0 : Formats reconnus pour les photos = JPEG
USB 2.0 : Formats reconnus pour la musique :
AC3 ( Dolby Digital ) , EAC3,HAAC,AAC, Mpeg, MP3, PCM, DTS
USB 2.0 : Formats reconnus pour les vidéos :
DivX HD, MKV, mpg, mpeg, H.264/AC


LG's Smart TVs only records on external HDD (40 GBs at least); USB sticks are only for playing contents. 

le formatage du HD 

When I then connected the drive to my Ubuntu Linux box, I could see that the LM760T had created a large partition of 596GB and a small partition of 47MB. The large partition (the first one on the disk) was formatted as JFS and the small partition was formatted as Ext3. But it's a bit more complicated than that, because the normal Partion ID/Filesystem type of these partions on Linux would be 83. However, the LM760T creates both partitions with a Partition ID of A2. This is an unknown filesystem type for any other systems or tools. I guess this is part of LG's deliberate policy of obfuscation.

So what do you need to do you if you want to record using your LG Smart TV, but still use the disk for something else? Well, unless you're happy with using the JFS partition for whatever you want to do, you will need to repartition the hard drive to make 3 or 4 partititions. The first two (JFS and Ext3) for the LG, and the third, with whatever filesystem you want, for the other stuff. You can't use the second LG partition (the Ext3 one) for anything else, because if you increase the size to anything useful, then your LG will take hours to connect after you plug it in.

So here's a step by step guide to formating your hard drive for use by the LG while still keeping a partition for other stuff.

First you will need a Linux box - I used Ubuntu 12.04. You might be able to do it using a Linux boot CD on a non-Linux PC, without installing Linux first, but I haven't tried this. I also use a Windows PC to fix the partition ID.

Connect your hard drive to the Linux box. You need to make sure the disk doesn't contain any data that you want to keep, as the first step is to delete all existing partitions.

You need a partition manager that supports JFS and Ext3 to set up the partitions. I used KDE Partition Manager plus the optional JFS package. You can install them on Ubuntu using the Software Center. First delete all existing partitions. Don't forget to apply the changes. Next create a primary JFS partition. The size of the partition is the amount of space you want to allow for LG recordings. I used about half the disk.

Next create a primary Ext3 partition. You need to allow about 50MB for this - don't make it any bigger, or else it will take a long time to connect, when you plug the drive into your TV.

You can use the remaining space to create a partition of whatever file system type you choose.

Then disconnect the drive from Linux, and connect it to a Windows PC. You need to use a physical disk editor to fix the partition IDs. I used Hxd - download from mh-nexus and install it in Windows. Incidentally I tried to install it in Linux using Wine, but could not successfully access the disk. Start HxD, and from the Extras menu, choose "Open Disk", clear the "Open as Readonly" check box and select the correct disk under "Physical disks". You will probably need to choose disk 2 if you only have one other hard drive in the system. Make sure you get the right one, or else you might render your system unbootable.

Now look for the two partition IDs, 83, which are located in the first disk sector. On my hard drive these two bytes are located at offset 1C4 and 1D4 (16 bytes apart). Change each of these two bytes to A2, and then close HxD.

Now you're done. Disconnect the hard drive from your PC and connect to the TV. It should say "Connecting USB", and then after a short wait, you are ready to start recording. You can still use partition 3 for whatever you choose on other PCs and devices, but the one drawback is that you will not be able to play any media files on your LG TV that were not recorded by it.

Further thoughts:
It would be even better if the video files recorded by the LG could be openned on a Windows or Linux PC. After you have made a few recordings, there will be some files on partitions 1 and 2. You may need to alter the permissions before you can see the files by connecting the drive to a Linux box and entering a command like this one (for Ubuntu):
sudo chmod -R 777 [volume mount point path]

After making a test recording I found directories 00000001REC, TMP and TS on partion 1, and files LGDB.vol, LGDB.bak, LGLOGDB.vol on Partition 2.
There are some biggish files in directory 00000001REC on Partition 1, which I guess must contain video data, but I have not been able to play these files using any of the main media players. Chances are the data is encrypted, so there's not much hope of decoding it, but any thoughts on how they could be accessed are welcome.

record on USB stick

It will work with any USB stick which shows up as local disk (not removable disk) in windows.

How to make a USB flash drive or an SD card to be identified in the system as a common local hard disk. You may ask why it is necessary. The matter is that by default Windows identifies all the flash drives and memory cards as removable drives that can not be split into several partitions with any of the standard Windows tools. And even if the USB flash drive is split into two or more partitions using third-party utilities (say, in Linux), only the first partition is available in Windows. I.e. Windows supports working with multiple partitions only for HDDs identified as local (i.e. non-removable) disks in the system.

Windows recognizes a USB flash drives as removable devices due to the presence of a special bit descriptor RMB (removable media bit) on each of the devices. If the system determines that RMB=1 when polling the connected device using StorageDeviceProperty, it concludes that this device is a removable drive. Thus, to make a system see a USB flash drive as a hard disk, it’s enough to modify this descriptor. You can do this directly (which is quite risky because of the differences in the device-specific hardware implementations, and not always possible), or indirectly, by substituting the response of a USB device using a special driver, which allows to filter the information in the response of the device.

Tutorial How to extract movies from an LG DVR/PVR HDD

1/ Extracting the videos
  • Option 1: Connect the TV HDD on Linux (Live-CD, VM, HDD etc.)
    1. Open the folder "00000001REC".
    2. The videos are the files ending with the suffix "STR". It's you decision to copy all files or just the "STR" files. Depending of the amount of files, it is more worthwhile to copy all. You need root access to copy the files.
  • Option 2: Using Nucleus Kernel JFS on Windows
    https://www.nucleustechnologies.com/Linux-Data-Recovery-Software.html
    1. Select the "Storage Device" at left menu.
    2. Check "Use Partition Table" option and click "Next" button (Sometimes NKJFS don't find the partitions, just reinstall NKJFS and try again).
    3. Select "JFS - 0" at left menu and click "Next" button.
    4. A window will open, check "Normal Search" option and click "Ok" button (wait about 5 seconds).
    5. Select the folder "00000001REC" on the left menu.
    6. The videos are the files ending with the suffix "STR". It's you decision to copy all files or just the "STR" files. Depending of the amount of files, it is more worthwhile to recover all.
  • option 3: mac, Paragon ExtFS  or fuse
    https://forums.macg.co/threads/lire-les-formats-ext3-ext4-sur-mac.1250560/
Paragon ExtFS
Provides MacOS and Windows machines native access to the Linux OS ext file system family
10 days full speed and functionality. After 10 days the only limitation is a cap of 5 Mb/s transfer rate.
ExtFS for Mac is a low-level file system driver which lets you work with Linux files on your Mac OS X with no hassle
Unprecedented high-level performance - the transfer rate is the same as with the native HFS file system
Able to store and create files greater than 4 GB
Auto-mounting of Ext2 / Ext3 / Ext4 volumes
http://alternativeto.net/software/paragon-extfs/
https://www.diskinternals.com/linux-reader/https://github.com/matt-wu/Ext3FsdDiskInternals Linux Reader is absolutely free. Secondly, the program provides for read-only access and does not allow you to make records in file system partitions. This guarantees that the interference in an alternative file system will not affect the work of Linux later.
Ext2/3/4; ReiserFS, Reiser4; HFS, HFS+; FAT, exFAT; NTFS, ReFS; UFS2

2/ Fixing the videos using TS Doctor
http://www.cypheros.de/tsdoctor2_e.html
30$ shareware
The TS-Doctor offers an easy-to-operate cropping function and together with the automatic advertizing recognition feature, makes it child’s play to remove bothersome advertizing interruptions from TV recording.
The TS-Doctor checks and repairs your TV recordings and makes sure that they can be easily processed and displayed on today’s media players. It can also handle formats that other programs often cannot read. (TS,TS4,M2TS,MTS,M2T,DVR,REC,TP,TPR and much more)
HDTV
The TS-Doctor can also handle HDTV recordings. HDTV means high-resolution television with brilliant picture and sound quality. In spite of large data files associated with HDTV, the TS-Doctor operates very quickly and without loss of picture. 
  1. Open TS Doctor, go to "File" menu and open the "STR" file without change the extension.
  2. Wait TS Doctor cheks the file, TS Doctor must find 2 tracks: H264 Video and AAC Audio English.
  3. If TS Doctor detects more than one audio track (E-AC3 German for example), click on Tools icon of the invalid track and uncheck "Stream Enabled". If you wish, change the language of the correct AAC track.
  4. Click "Save new File" button and choose a new name for the file.
  5. A file with "fixed" sufix and "ts" extension will be created.

3/ Joining the fixed video files

  1. Open the Windows prompt.
  2. Use the "copy" command to join the video files:
copy /B fixed1.ts + fixed2.ts + ... + fixedN.ts output_file.ts

4/ Playing the videos

  • Option 1: Use VLC Player (or TotalMedia)
    If you don't uncheck the invalid audio track on TS Doctor: On videos with more than one audio track, Totalmedia detects automatically the correct track, on VLC player the track must be selected manually. Anyway you can select the track order on TS Doctor by changing the AAC track to first position.
  • Option 2: Using other players (Need VLC Player and Haali Media Splitter http://haali.su/mkv/)
  • Generating the audio track
    1. Open VLC Player.
    2. Go to "Media" / "Convert/Save...".
    3. Add the joined/fixed "ts" file(s) created with TS Doctor.
    4. Click on "Convert / Save" button.
    5. Choose the name for the destination file (MP3).
    6. Change the profile to "Audio - MP3".
    7. Click on "Start" button.
  • Joining video and audio track in a mkv file
    1. Open Haali GDS Mux.
    2. Add the joined/fixed ts file(s) created with TS Doctor.
    3. Add the mp3 file created with VLC.
    4. Choose a output mkv file name.
    5. Click on "Start" button.

some hidden features

LG tv's have some hidden features distinguished for service staff only.
http://openlgtv.org.ru/wiki/index.php/Hidden_service_modes_/_menus

Sunday, August 20, 2017

copier des sous-titres dans une vidéo


On peut être amenés à souhaiter que les sous-titres soient directement incrustés sur l’image et non dans un fichier séparé. Il faut alors fusionner les deux fichiers.

Ce sera le cas pour :

  • diffuser sur le web avec un lecteur qui ne reconnait pas le format de sous-titres texte,
  • diffuser avec une platine DVD ou sur une smart TV qui ne reconnaît pas les sous-titres texte,
  • prendre un extrait d’une vidéo sous-titrée sans avoir à splitter séparément le fichier sous-titres avec les problèmes de synchronisation que ça pourra entraîner.

Plusieurs programmes permettent de « fusionner » un fichier video et un fichier sous-titres. Le résultat est un unique fichier vidéo, les sous-titres sont directement incrustés « en dur » sur les images et ne peuvent plus être masqués ou modifiés.

Avec Avidemux

Avidemux permet de manipuler beaucoup de formats différents (les codecs biz pour l’encodage doivent être installés).
Avidemux est un éditeur vidéo gratuit conçu pour des tâches simples de coupe, de filtrage et d'encodage. Il prend en charge de nombreux types de fichiers, y compris les fichiers MPEG compatibles AVI, DVD, MP4 et ASF, en utilisant une variété de codecs.
Les tâches peuvent être automatisées en utilisant des projets, une file d'attente de travail et de puissantes capacités de script.
Avidemux est disponible pour Linux, BSD, Mac OS X et Microsoft Windows sous la licence GNU GPL.

On peut aussi ajouter des pistes audio avec n langages.

http://avidemux.sourceforge.net/

  1. ouvrir le fichier vidéo avec Avidemux
  2. ajouter un filtre video, choisir « subtitler » dans la section Soustitres
  3. paramétrer le filtre (indiquer le fichier des sous-titres, paramétrer le positionnement et l’apparence du texte, choisir latin-1 ou UTF-8 pour le jeu de caractères)
  4. au besoin indiquer le début et la fin de l’extrait souhaité
  5. paramétrer les options d’encodage (codec et options de compression - dans le doute choisissez Xvid à 1000Kbps pour la vidéo, vous pouvez laisser l’Audio sur « copier »)
  6. enregistrer une copie avec les options choisies « Fichier > Enregistrer > Enregistrer vidéo »

Xvid

XviD avec DivX sont les vidéos les plus normalement codées. DivX était le plus répandu, jusqu'à ce qu'il soit passé d'open source à non-open. XviD a été choisi, compte tenu du fait qu'il est open/free source et d'autres raions. 

Ref

http://another-teacher.net/spip.php?article242

format sous-titre

Convertir des fichiers de sous-titres (srt, sub, ssa, txt)
tool for creating and modifying subtitles

pour windows

http://www.commentcamarche.net/faq/17393-convertir-des-fichiers-de-sous-titres-srt-sub-ssa-txt

pour mac et free, cross-platform open source

http://www.aegisub.org/