<![CDATA[Forum Ubuntu-fr.org / Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?id=163729 Sat, 27 Apr 2013 23:25:10 +0000 FluxBB <![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=13350311#p13350311 Hello,

Merci pour ce script, malheureusement, ça ne marche pas chez moi et je ne comprends pas bien ce qu'il me raconte... Avez-vous une idée ?

$ ts2avi.py France\ 2\ -\ france2\ -\ 28-04-2013\ 00h38\ 02m.ts

Converting file France 2 - france2 - 28-04-2013 00h38 02m.ts
Traceback (most recent call last):
  File "/usr/local/bin/ts2avi.py", line 165, in <module>
    main()
  File "/usr/local/bin/ts2avi.py", line 159, in main
    this_convert = ConvertToAvi(arg, **options.__dict__)
  File "/usr/local/bin/ts2avi.py", line 72, in __init__
    self.final_avifile = os.path.join(self.output_dir, self._avifile)
  File "/usr/lib/python2.6/posixpath.py", line 67, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

Merci bien !

]]>
Sat, 27 Apr 2013 23:25:10 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=13350311#p13350311
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=7726801#p7726801 scripte modifier pour corriger décalage de son.
syntaxe:
ts2avi monfichier.ts -t
pour faire un test sur les 1000 premier frame.
ts2avi monfichier.ts pour créer le fichier final.
si un décalage  de son persiste tous de même aprés.
lancer cette commande ffmpeg -itsoffset 1.8 -i monfichier.tmp.ts -i monfichier.mp3 -vcodec copy -acodec copy monfichier.avi
en modifiant les noms de fichiers en conséquence et la valeur de décalage voulu.

sa ma permit d'avoir un fichier.ts de 900 mo en un fichier.avi de 240 mo sans perte de qualité notable.

#!/bin/sh
 
DIR=`pwd`
cd $DIR
 
# Variables
BITRATE="1200"
DECSOUND="1.8"
# Pour enlever les bandes noires ; recopier les valeurs données par la commande "mplayer -vf cropdetect monfichier.ts"
CROPID=$(mplayer -vf cropdetect -frames 10 $1 2>/dev/null | grep crop | sort -u | sed -e "s/)/=/g"|cut -d"=" -f2)
SCALEID="688:544"
# Pour faire un test sur les premières frames
if [ $2 = "-t" ];then
        FRAMES="-frames 1000"
else
# extraction piste audio
filesound=$1".mp3"
ffmpeg -i $1  -vn -f mp3 $filesound
fi
 
 
if [ -f "divx2pass.log" ]
then
        rm -f divx2pass.log
fi
 
# Fichier de sortie
y=`echo $1 | sed 's/ts/avi/'`
filetmp=`echo $1 | sed 's/ts/tmp.avi/'`
# Première passe
mencoder $1 $FRAMES -fps 25 -ofps 25 -nosound -ovc xvid -xvidencopts pass=1 -vf crop=$CROPID,pp=de/lb,hqdn3d=4:3:6,scale=$SCALEID -o /dev/null
 
# Seconde passe
mencoder $1 $FRAMES -fps 25 -ofps 25 -nosound -ovc xvid -xvidencopts bitrate=$BITRATE:pass=2 -vf crop=$CROPID,pp=de/lb,hqdn3d=4:3:6,scale=$SCALEID -o $filetmp
 
if [  $2 != "-t" ];then
        # ajout de la bande son au fichier
        ffmpeg -itsoffset $DECSOUND -i $filetmp -i $filesound -vcodec copy -acodec copy $y
fi
rm -f divx2pass.log
cd $DIR
]]>
Sat, 07 Jan 2012 13:25:22 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=7726801#p7726801
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=6335771#p6335771 A tous :
J'ai créé un script python "ts2avi" qui utilise mencoder pour convertir les fichier ts en avi. Il est disponible sur  pypi.
Dépaquetez l'archive dans un répertoire quelconque et lisez le README.txt. Je vous conseille d'utiliser les dernières possibilités de python pour l'installer en local via l'option --user.

Ce script utilise tous les conseils que j'ai pu glaner sur le web afin de convertir avec la meilleure qualité possible ces fichiers :
* On convertit le container TS en MPEG
* On convertit ensuite l'audio en MP3
* Puis on effectue 2 passes d'encodage vidéo en mpeg4.

Vous avez quelques options possibles et notamment deux profils, un 'default' et un 'fast', censé être plus rapide mais avec un moins bonne qualité. Pour avoir la liste des options :

ts2avi.py --help

Le script reconnaît les pattern unix, donc pour convertir par exemple tous les fichiers TS d'un répertoire :

ts2avi.py *.ts

Si certains sont intéressés pour m'aider à enrichir le script, n'hésitez pas à me contacter. C'est une version bêta, merci d'être tolérants ! Pour l'instant la gestion des erreurs laisse à désirer et j'ai encore des problèmes de conversion pour des fichiers issus de certaines chaînes de télé de la freebox, il faut que je pousse l'investigation. Évidemment, comme mentionné plus haut, il faut avoir installé mencoder qui est inclus dans le paquetage du même nom (apt://mencoder) !

]]>
Tue, 27 Sep 2011 20:14:34 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=6335771#p6335771
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=3855399#p3855399 J'ai la même chose que toi dans mes dépots

Et oui tu as bien compris, c'est exactement mon probleme...que je n'arrive touojours pas à résoudre

]]>
Wed, 17 Nov 2010 19:37:07 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=3855399#p3855399
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=3855127#p3855127 Personnellement, j'ai ces dépôts d'installées dans synaptic

lame
twolame
ubuntu-restricted-extras

Il servent peut-être pour avidemux ?

Si j'ai bien compris, lorsque tu cliques sur les flèches à droite de copy dans le paragraphe Audio rien ne s'affiche ?

]]>
Wed, 17 Nov 2010 17:25:27 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=3855127#p3855127
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=3853553#p3853553 Quelqu'un peut il m'aider SVP ?

PS : je suis passé à Ubuntu 10.10 et j'ai toujours le même probleme

]]>
Tue, 16 Nov 2010 19:29:30 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=3853553#p3853553
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=3846031#p3846031 Bonjour Je suis sous Ubuntu 10.04.1 LTS et je n'arrive pas à aller chercher le codec audio LAME alors que je suis sur qu'il est installé
Dans la partie audio d'Avidemux j'ai juste "copie" d'affiché

Y a t'il une méthode pour remédier à cela en allant "lier les codecs à Avidemux ?

Merci pour votre aide

]]>
Fri, 12 Nov 2010 15:35:25 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=3846031#p3846031
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=3816052#p3816052 Avez-vous des solutions sans même transcoder, découper des freebox.ts(AVC - AAC) ?

J'ai posté : avec mes différents tests sans trop de résultat.

]]>
Thu, 28 Oct 2010 12:22:04 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=3816052#p3816052
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=2443430#p2443430 Bonjour,

Depuis le passage à Intrepid IBEX, je n'arrive plus à transcoder en Dummy avec VLC les émissions de la Freebox. Quelqu'un y est-il parvenu (de façon aussi simple qu'avec le tuto de boubou_cs du 7/11/07) ?

En vous remerciant par avance de vos réponses.

]]>
Sat, 21 Feb 2009 16:27:54 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=2443430#p2443430
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=2285617#p2285617 Ok. Essaie :

mplayer -vf cropdetect -frames 10 jh.avi 2>/dev/null| awk '$0~"CROP" {print substr($0,match($0,"-vf"),match($0,"\)")-match($0,"-vf"))}'
mplayer -vf cropdetect -frames 10 jh.avi 2>/dev/null| awk '$0~"CROP" {print substr($0,match($0,"-vf"),match($0,"\)")-match($0,"-vf"))}'|tail -n 1

Et si ça renvoie un truc correct (à savoir, quelque chose comme « -vf crop=336:224:8:8 »), alors il suffit de corriger le script par :

#!/bin/bash

DIR=`pwd`
cd "/tmp"

# Variables
BITRATE="1400"
CROP=`mplayer -vf cropdetect -frames 100 ${1} 2>/dev/null| awk '$0~"CROP" {print substr($0,match($0,"-vf"),match($0,"\)")-match($0,"-vf"))}'|tail -n 1`
SCALEID="688:544"
# Pour faire un test sur les premières frames
#FRAMES="-frames 1000"


if [ -f "divx2pass.log" ]
then
        rm -f divx2pass.log
fi

# Fichier de sortie
y=`echo ${1} | sed 's/ts/avi/'`

# Première passe
mencoder ${1} ${FRAMES} -fps 25 -ofps 25 -nosound -ovc xvid -xvidencopts pass=1 ${CROP},pp=de/lb,hqdn3d=4:3:6,scale=${SCALEID} -o /dev/null

# Seconde passe
mencoder ${1} ${FRAMES} -fps 25 -ofps 25 -oac mp3lame -lameopts abr:br=128 -ovc xvid -xvidencopts bitrate=${BITRATE}:pass=2 ${CROP},pp=de/lb,hqdn3d=4:3:6,scale=${SCALEID} -o ${y}

rm -f divx2pass.log
cd ${DIR}

Explication : dans la commande il y a une parenthèse que awk doit interpréter comme simple caractère. Chez moi je n'ai pas besoin de l'échapper, mettre la parenthèse entre guillemets suffit. Apparemment, sous Ubuntu elle est interprétée comme parenthèse malgré les guillemets, ce qui pose évidemment un problème. Il faut donc l'« échapper », en rajoutant un antislash devant : "\)".

Ça devrait marcher, par contre je ne garantie rien pour les autres erreurs et la taille, et ça j'aurai pas le temps de m'y pencher avant longtemps… hmm

]]>
Tue, 16 Dec 2008 23:51:59 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=2285617#p2285617
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=2285594#p2285594 Bonjour,

Et merci. tout d'abord je suis aussi très oqp (mes jumeaux arrivent juste à la maison) donc tout vient à point...

ci dessous les resultats:

sebastien@Seb:~/Desktop$ mplayer -vf cropdetect -frames 10 jh.avi
MPlayer 1.0rc2-4.3.2 (C) 2000-2007 MPlayer Team
CPU: AMD Opteron(tm) Processor 146 (Family: 15, Model: 39, Stepping: 1)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing jh.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO:  [XVID]  544x576  12bpp  25.000 fps  -17179870.0 kbps (-2097152.0 kbyte/s)
Clip info:
 Software: MEncoder 2:1.0~rc2-0ubuntu17+medibuntu1
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
Opening video filter: [cropdetect]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Forced audio codec: mad
Opening audio decoder: [libmad] libmad mpeg audio decoder
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Selected audio codec: [mad] afm: libmad (libMAD MPEG layer 1-2-3)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
VDec: vo config request - 544 x 576 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 544x576 => 1024x576 Planar YV12 
[CROP] Crop area: X: 0..543  Y: 6..575  (-vf crop=544:560:0:12). 0 
[CROP] Crop area: X: 0..543  Y: 6..575  (-vf crop=544:560:0:12). 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).2 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).2 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).2 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).2 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).2 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).2 0 
A:   0.5 V:   0.5 A-V:  0.046 ct:  0.048  13/ 13 ??% ??% ??,?% 2 0 
GNOME screensaver enabled

Exiting... (End of file)
sebastien@Seb:~/Desktop$
sebastien@Seb:~/Desktop$ mplayer -vf cropdetect -frames 10 jh.avi 2>/dev/null
MPlayer 1.0rc2-4.3.2 (C) 2000-2007 MPlayer Team
CPU: AMD Opteron(tm) Processor 146 (Family: 15, Model: 39, Stepping: 1)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.

Playing jh.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO:  [XVID]  544x576  12bpp  25.000 fps  -17179870.0 kbps (-2097152.0 kbyte/s)
Clip info:
 Software: MEncoder 2:1.0~rc2-0ubuntu17+medibuntu1
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
Opening video filter: [cropdetect]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Forced audio codec: mad
Opening audio decoder: [libmad] libmad mpeg audio decoder
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Selected audio codec: [mad] afm: libmad (libMAD MPEG layer 1-2-3)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
VDec: vo config request - 544 x 576 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 544x576 => 1024x576 Planar YV12 
[CROP] Crop area: X: 0..543  Y: 6..575  (-vf crop=544:560:0:12). 0 
[CROP] Crop area: X: 0..543  Y: 6..575  (-vf crop=544:560:0:12). 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).0 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).0 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).0 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).0 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).0 0 
[CROP] Crop area: X: 0..543  Y: 0..575  (-vf crop=544:576:0:0).0 0 
A:   0.5 V:   0.5 A-V:  0.046 ct:  0.048  13/ 13 ??% ??% ??,?% 0 0 
GNOME screensaver enabled

Exiting... (End of file)
sebastien@Seb:~/Desktop$
sebastien@Seb:~/Desktop$ mplayer -vf cropdetect -frames 10 jh.avi 2>/dev/null| awk '$0~"CROP" {print substr($0,match($0,"-vf"),match($0,")")-match($0,"-vf"))}'
awk: line 1: regular expression compile failed (missing '(')
)
sebastien@Seb:~/Desktop$
]]>
Tue, 16 Dec 2008 23:37:06 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=2285594#p2285594
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=2283047#p2283047 pfff a écrit :
File not found: ',pp=de/lb,hqdn3d=4:3:6,scale=688:544'
Failed to open ,pp=de/lb,hqdn3d=4:3:6,scale=688:544.
Cannot open file/device.

Pour le reste je sais pas, mais déjà là il y a un problème : la variable $CROP est vide. Il est possible que le résultat d'mplayer soit différent entre Ubuntu et mon Archlinux.

Est-ce que tu peux faire tourner ces commandes sur n'importe quelle vidéo et poster le résultat :

mplayer -vf cropdetect -frames 10 vidéo.avi
mplayer -vf cropdetect -frames 10 vidéo.avi 2>/dev/null
mplayer -vf cropdetect -frames 10 vidéo.avi 2>/dev/null| awk '$0~"CROP" {print substr($0,match($0,"-vf"),match($0,")")-match($0,"-vf"))}'
mplayer -vf cropdetect -frames 10 vidéo.avi 2>/dev/null| awk '$0~"CROP" {print substr($0,match($0,"-vf"),match($0,")")-match($0,"-vf"))}'|tail -n 1

(si ça se trouve la première sera suffisante pour le diagnostic, mais comme je suis un peu surbooké en ce moment et que je bouge jeudi et que j'aurai peut-être pas le temps ou la possibilité de regarder ça après, mieux vaut jouer large… wink)

]]>
Mon, 15 Dec 2008 23:04:03 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=2283047#p2283047
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=2280761#p2280761 parfait ca a converti... mais j'ai pas mal d'erreur et un fichier de sortie à 1.9go...
y'aurait moyen de le compresser?

FAAD: error: Unable to find ADTS syncword, trying to resync!V:-0.026 [1394:120]
FAAD: Failed to decode frame: Unable to find ADTS syncword 
[h264 @ 0x88443f0]MBAFF + spatial direct mode is not implemented
[h264 @ 0x88443f0]MBAFF + spatial direct mode is not implemented
[h264 @ 0x88443f0]MBAFF + spatial direct mode is not implemented
[h264 @ 0x88443f0]MBAFF + spatial direct mode is not implemented
FAAD: error: Unable to find ADTS syncword, trying to resync!V:-0.030 [1394:120]
FAAD: Failed to decode frame: Unable to find ADTS syncword 
FAAD: error: Unable to find ADTS syncword, trying to resync!V:-0.028 [1394:120]
FAAD: Failed to decode frame: Unable to find ADTS syncword 
FAAD: error: Unable to find ADTS syncword, trying to resync!V:-0.030 [1394:120]
FAAD: Failed to decode frame: Unable to find ADTS syncword 
File not found: ',pp=de/lb,hqdn3d=4:3:6,scale=688:544'
Failed to open ,pp=de/lb,hqdn3d=4:3:6,scale=688:544.
Cannot open file/device.

Exiting...
]]>
Mon, 15 Dec 2008 06:03:46 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=2280761#p2280761
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=2280254#p2280254 Merci c a l'air de fonctionner !!!

]]>
Sun, 14 Dec 2008 20:34:09 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=2280254#p2280254
<![CDATA[Réponse à : Transcoder une emission de la freebox .ts(.mpg) en fichier .avi (Xvid)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=2278953#p2278953 Amélioration du script précédent pour qu'il détecte automatiquement les bandes noires. Pas testé, mais ça devrait rouler. wink

#!/bin/bash

DIR=`pwd`
cd "/tmp"

# Variables
BITRATE="1400"
CROP=`mplayer -vf cropdetect -frames 100 ${1} 2>/dev/null| awk '$0~"CROP" {print substr($0,match($0,"-vf"),match($0,")")-match($0,"-vf"))}'|tail -n 1`
SCALEID="688:544"
# Pour faire un test sur les premières frames
#FRAMES="-frames 1000"


if [ -f "divx2pass.log" ]
then
        rm -f divx2pass.log
fi

# Fichier de sortie
y=`echo ${1} | sed 's/ts/avi/'`

# Première passe
mencoder ${1} ${FRAMES} -fps 25 -ofps 25 -nosound -ovc xvid -xvidencopts pass=1 ${CROP},pp=de/lb,hqdn3d=4:3:6,scale=${SCALEID} -o /dev/null

# Seconde passe
mencoder ${1} ${FRAMES} -fps 25 -ofps 25 -oac mp3lame -lameopts abr:br=128 -ovc xvid -xvidencopts bitrate=${BITRATE}:pass=2 ${CROP},pp=de/lb,hqdn3d=4:3:6,scale=${SCALEID} -o ${y}

rm -f divx2pass.log
cd ${DIR}

À lancer par "ts2avi monfichier.ts".

]]>
Sun, 14 Dec 2008 12:20:51 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=2278953#p2278953