
Recherche avancée
Autres articles (86)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (12383)
-
How can I convert .MTS file (AVCHD) to .mp4 by ffmpeg without re-encoding H264 video stream correctly ?
31 décembre 2022, par kaorukobo


I posted an same question to another community Video Production that I've found later, and which seems to be a better place for this question :








1. What I tried



I have some .MTS (AVCHD format) files recoreded with my AVCHD camera. Its specification is as shown below :



$ ffprobe 140612_Canon-00000.MTS 
ffprobe version 2.2.1 Copyright (c) 2007-2014 the FFmpeg developers
(snip)
Input #0, mpegts, from '140612_Canon-00000.MTS':
 Duration: 00:48:58.40, start: 0.800300, bitrate: 5563 kb/s
 Program 1 
 Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), 
 yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], 
 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
 Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
 stereo, fltp, 256 kb/s




Pay attention to the part of framerate/timebase : 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc



Now I’d like to convert this file to .mp4 file, without re-encoding H264 video stream, on the other hand, with transcoding its audio stream to AAC.
So I tried the following command :



ffmpeg -i 140612_Canon-00000.MTS -t 60 -y -vcodec copy -acodec libfaac -ab 128k 140612_Canon-00001.MTS.mp4




2. Result



and output file’s specification is as shown below :



$ ffprobe 140612_Canon-00000.MTS.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '140612_Canon-00000.MTS.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf55.33.100

 Duration: 00:01:00.04, start: 0.021333, bitrate: 4590 kb/s

 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
 1440x1080 [SAR 4:3 DAR 16:9], 4448 kb/s, 
 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc (default)
 Metadata:
 handler_name : VideoHandler

 Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 
 48000 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 handler_name : SoundHandler




Look at the part of framerate/timebase : 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc.
Although ffmpeg just copied the video stream, framerate and timebase has been changed to twice value.



So, when I open and playback the output file with QuickTime Player or VLC Player,
the audio has no problem, however, the video stream is not played correctly.
The video is played back with having its frame forward and backward quiveringly repeatedly.



3. Question



- 

- How can I convert .MTS file (AVCHD) to .mp4 by ffmpeg without re-encoding H264 video stream correctly ?
- How can I keep the original framerate/timebase values (fps/tbr/tbn/tbc) when I convert the container with
ffmpeg
and its-vcodec copy
switch. - How can I set framerate/timebase values (fps/tbr/tbn/tbc) by ffmpeg’s command line options without re-encoding a video stream.









Any ideas ?


-
pip path : anaconda vs. native python (on macOS)
26 juin 2020, par Hubert SchölnastI am using macOS X and I installed native Python 3.8 in April, and the packages of this version are stored in :


/Users/hubert/Library/Python/3.8/lib/python/site-packages/



Some weeks later, in May, I installed Anaconda, but it uses a different path for it's packages :


/Users/hubert/opt/anaconda3/lib/python3.7/site-packages/



Today I needed to install a new package to be used in a native Python script. I typed :


pip install ffmpeg



I've got a success-message. But when I wanted to run my script, it couldn't find ffmpeg. I rebooted my Mac, but the script still couldn't find it. So I again tried
pip install ffmpeg
. Now I did get this message :

Requirement already satisfied: ffmpeg in ./opt/anaconda3/lib/python3.7/site-packages (1.4)



But obviously native Pythons wants to have it in the other path.


My questions :


- 

- Is it save to just copy the directories
ffmpeg
andffmpeg-1.4.dist-info
from the anaconda directory to the native directory ? - How can I tell pip to use the native Python directory to install new packages ?
- Is it a good idea to merge the two site-packages directories ? And if it's a good idea : What is the best way to let native Python 3.8 and Anaconda (which obviously uses Python 3.7) use the same site-packages directory ?








- Is it save to just copy the directories
-
FFmpeg freezes during trim, concat and add watermark
14 juin 2020, par Nguyễn TrọngI'm trying to cut each video and change the speed of each, then I join them and finally add watermark. I calculated the percentage of the process and found it was working fine but it did not run to the onFinished function but stood still.I do not have a lot of clues why it happens. Anybody experienced something similar ?



cmd = [-y, -i, /storage/emulated/0/Story Saver/test.mp4, -i, /storage/emulated/0/.FXMotion/.LOGO/logo_watermark.png, -filter_complex_script, /storage/emulated/0/.FXMotion/.Script/script.txt, -map, [vw], -c:v, libx264, -pix_fmt, yuv420p, -crf, 18, -preset, veryfast, /storage/emulated/0/FXMotion/output.mp4, -hide_banner]




onProgress: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Story Saver/test.mp4':
onProgress: Metadata:onProgress: major_brand : isomonProgress: minor_version : 512:
onProgress: compatible_brands: isomiso2avc1mp41
onProgress: encoder : Lavf58.20.100onProgress: Duration: 00:00:10.40, start: 0.000000, bitrate: 1877 kb/s
onProgress: 
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 540x960, 1804 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
onProgress: Metadata:onProgress: handler_name : VideoHandleronProgress: Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
onProgress: Metadata:
onProgress: handler_name : SoundHandler
onProgress: Input #1, png_pipe, from '/storage/emulated/0/.FXMotion/.LOGO/logo_watermark.png':
onProgress: Duration: N/A, bitrate: N/A
onProgress: Stream #1:0: Video: png, rgba(pc), 335x51, 25 tbr, 25 tbn, 25 tbc
onProgress: Stream mapping:
onProgress: Stream #0:0 (h264) -> trim
onProgress: Stream #0:0 (h264) -> trim
onProgress: Stream #0:0 (h264) -> trim
onProgress: Stream #0:0 (h264) -> trim
onProgress: Stream #0:1 (aac) -> atrim
onProgress: Stream #0:1 (aac) -> atrim
onProgress: Stream #0:1 (aac) -> atrim
onProgress: Stream #0:1 (aac) -> atrim
onProgress: Stream #0:1 (aac) -> atrim
onProgress: Stream #0:1 (aac) -> atrim
onProgress: Stream #0:1 (aac) -> atrim
 onProgress: Stream #0:1 (aac) -> atrim
onProgress: Stream #0:1 (aac) -> atrim
 onProgress: Stream #0:1 (aac) -> atrim
 onProgress: Stream #0:1 (aac) -> atrim
 onProgress: Stream #0:1 (aac) -> atrim
onProgress: Stream #0:1 (aac) -> atrim
 onProgress: Stream #1:0 (png) -> scale
 onProgress: concat:out:a0 -> Stream #0:0 (aac)
 onProgress: overlay -> Stream #0:1 (libx264)
onProgress: Press [q] to stop, [?] for help
onProgress: [libx264 @ 0xf1cba100] using cpu capabilities: ARMv6 NEON
onProgress: [libx264 @ 0xf1cba100] profile High, level 3.1
onProgress: [libx264 @ 0xf1cba100] 264 - core 152 r2851M ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
onProgress: Output #0, mp4, to '/storage/emulated/0/FXMotion/Motion_441753_07_09.mp4':
onProgress: Metadata:
onProgress: major_brand : isom
onProgress: minor_version : 512
onProgress: compatible_brands: isomiso2avc1mp41
onProgress: encoder : Lavf58.12.100
onProgress: Stream #0:0: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
onProgress: Metadata:
onProgress: encoder : Lavc58.18.100 aac
onProgress: Stream #0:1: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 540x960, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
onProgress: Metadata:
onProgress: encoder : Lavc58.18.100 libx264
onProgress: Side data:
onProgress: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
onProgress: frame= 3 fps=0.0 q=0.0 size= 0kB time=00:00:00.06 bitrate= 5.5kbits/s speed=0.138x 
onProgress: frame= 22 fps= 22 q=0.0 size= 0kB time=00:00:00.71 bitrate= 0.5kbits/s dup=2 drop=0 speed=0.712x 
onProgress: frame= 47 fps= 31 q=24.0 size= 256kB time=00:00:01.50 bitrate=1389.8kbits/s dup=7 drop=0 speed=0.998x 
onProgress: frame= 64 fps= 32 q=24.0 size= 512kB time=00:00:02.08 bitrate=2007.2kbits/s dup=12 drop=0 speed=1.03x 
onProgress: frame= 86 fps= 34 q=24.0 size= 768kB time=00:00:02.83 bitrate=2221.1kbits/s dup=21 drop=0 speed=1.12x 
onProgress: frame= 104 fps= 34 q=24.0 size= 768kB time=00:00:03.41 bitrate=1843.3kbits/s dup=29 drop=0 speed=1.12x 
onProgress: frame= 121 fps= 34 q=24.0 size= 1024kB time=00:00:03.99 bitrate=2100.5kbits/s dup=37 drop=0 speed=1.13x 
onProgress: frame= 138 fps= 34 q=24.0 size= 1280kB time=00:00:04.57 bitrate=2292.4kbits/s dup=46 drop=0 speed=1.13x 
onProgress: frame= 157 fps= 34 q=24.0 size= 1280kB time=00:00:05.24 bitrate=1998.2kbits/s dup=56 drop=0 speed=1.15x 
onProgress: frame= 179 fps= 35 q=24.0 size= 1536kB time=00:00:05.92 bitrate=2125.2kbits/s dup=67 drop=0 speed=1.16x 
onProgress: frame= 196 fps= 35 q=24.0 size= 1792kB time=00:00:06.45 bitrate=2274.2kbits/s dup=76 drop=0 speed=1.15x 
onProgress: frame= 212 fps= 35 q=24.0 size= 2048kB time=00:00:06.98 bitrate=2400.5kbits/s dup=84 drop=0 speed=1.15x 
onProgress: frame= 228 fps= 34 q=24.0 size= 2048kB time=00:00:07.56 bitrate=2216.4kbits/s dup=91 drop=0 speed=1.14x 
onProgress: frame= 248 fps= 35 q=24.0 size= 2304kB time=00:00:08.19 bitrate=2302.8kbits/s dup=97 drop=0 speed=1.15x 
onProgress: Past duration 0.690956 too large
onProgress: Past duration 0.882378 too large
onProgress: Past duration 0.682365 too large
onProgress: Past duration 0.973366 too large
onProgress: frame= 269 fps= 35 q=24.0 size= 2304kB time=00:00:08.82 bitrate=2139.1kbits/s dup=99 drop=1 speed=1.16x 
onProgress: frame= 284 fps= 35 q=24.0 size= 2560kB time=00:00:09.35 bitrate=2241.2kbits/s dup=99 drop=9 speed=1.15x 
onProgress: frame= 300 fps= 35 q=24.0 size= 2816kB time=00:00:09.86 bitrate=2337.7kbits/s dup=99 drop=18 speed=1.14x 
onProgress: frame= 315 fps= 34 q=24.0 size= 2816kB time=00:00:10.40 bitrate=2217.7kbits/s dup=99 drop=26 speed=1.14x 
onProgress: Past duration 0.878990 too large
onProgress: frame= 332 fps= 34 q=24.0 size= 3072kB time=00:00:10.95 bitrate=2296.2kbits/s dup=99 drop=31 speed=1.13x 
onProgress: frame= 351 fps= 35 q=24.0 size= 3328kB time=00:00:11.63 bitrate=2343.6kbits/s dup=99 drop=31 speed=1.14x 
onProgress: Past duration 0.931847 too large
onProgress: Past duration 0.982628 too large
onProgress: frame= 371 fps= 35 q=24.0 size= 3328kB time=00:00:12.30 bitrate=2215.4kbits/s dup=99 drop=31 speed=1.15x 






EDIT-update content of script






Edit 2(reduce inputs)