
Recherche avancée
Médias (2)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (17)
-
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...) -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)
Sur d’autres sites (5075)
-
Writing A Dreamcast Media Player
6 janvier 2017, par Multimedia Mike — Sega DreamcastI know I’m not the only person to have the idea to port a media player to the Sega Dreamcast video game console. But I did make significant progress on an implementation. I’m a little surprised to realize that I haven’t written anything about it on this blog yet, given my propensity for publishing my programming misadventures.
This old effort had been on my mind lately due to its architectural similarities to something else I was recently brainstorming.
Early Days
Porting a multimedia player was one of the earliest endeavors that I embarked upon in the multimedia domain. It’s a bit fuzzy for me now, but I’m pretty sure that my first exposure to the MPlayer project in 2001 arose from looking for a multimedia player to port. I fed it through the Dreamcast development toolchain but encountered roadblocks pretty quickly. However, this got me looking at the MPlayer source code and made me wonder how I could contribute, which is how I finally broke into practical open source multimedia hacking after studying the concepts and technology for more than a year at that point.Eventually, I jumped over to the xine project. After hacking on that for awhile, I remembered my DC media player efforts and endeavored to compile xine to the console. The first attempt was to simply compile the codebase using the Dreamcast hobbyist community’s toolchain. This is when I came to fear the multithreaded snake pit in xine’s core. Again, my memories are hazy on the specifics, but I remember the engine having a bunch of threading hacks with comments along the lines of “this code deadlocks sometimes, so on shutdown, monitor this lock and deliberately break it if it has been more than 3 seconds”.
Something Workable
Eventually, I settled on a combination of FFmpeg’s libavcodec library for audio and video decoders, xine’s demuxer library, and xine’s input API, combined with my own engine code to tie it all together along with video and output drivers provided by the KallistiOS hobbyist OS for Dreamcast. Here is a simple diagram of the data movement through this player :
Details and Challenges
This is a rare occasion when I actually got to write the core of a media player engine. I made some mistakes.xine’s internal clock ran at 90000 Hz. At least, its internal timestamps were all in reference to a 90 kHz clock. I got this brilliant idea to trigger timer interrupts at 6000 Hz to drive the engine. Whatever the timer facilities on the Dreamcast, I found that 6 kHz was the greatest common divisor with 90 kHz. This means that if I could have found an even higher GCD frequency, I would have used that instead.
So the idea was that, for a 30 fps video, the engine would know to render a frame on every 200th timer interrupt. I eventually realized that servicing 6000 timer interrupts every second would incur a ridiculous amount of overhead. After that, my engine’s philosophy was to set a timer to fire for the next frame while beginning to process the current frame. I.e., when rendering a frame, set a timer to call back in 1/30th of a second. That worked a lot better.
As I was still keen on 8-bit paletted image codecs at the time (especially since they were simple and small for bootstrapping this project), I got to use output palette images directly thanks to the Dreamcast’s paletted textures. So that was exciting. The engine didn’t need to convert the paletted images to a different colorspace before rendering. However, I seem to recall that the Dreamcast’s PowerVR graphics hardware required that 8-bit textures be twiddled/swizzled. Thus, it was still required to manipulate the 8-bit image before rendering.
I made good progress on this player concept. However, a huge blocker for me was that I didn’t know how to make a proper user interface for the media player. Obviously, programming the Dreamcast occurred at a very low level (at least with the approach I was using), so there were no UI widgets easily available.
This was circa 2003. I assumed there must have been some embedded UI widget libraries with amenable open source licenses that I could leverage. I remember searching and checking out a library named libSTK. I think STK stood for “set-top toolkit” and was positioned specifically for doing things like media player UIs on low-spec embedded computing devices. The domain hosting the project is no longer useful but this appears to be a backup of the core code.
It sounded promising, but the libSTK developers had a different definition of “low-spec embedded” device than I did. I seem to recall that they were targeting something along with likes of a Pentium III clocked at 800 MHz with 128 MB RAM. The Dreamcast, by contrast, has a 200 MHz SH-4 CPU and 16 MB RAM. LibSTK was also authored in C++ and leveraged the Boost library (my first exposure to that code), and this all had the effect of making binaries quite large while I was trying to keep the player in lean C.
Regrettably, I never made any serious progress on a proper user interface. I think that’s when the player effort ran out of steam.
The Code
So, that’s another project that I never got around to finishing or publishing. I was able to find the source code so I decided to toss it up on github, along with 2 old architecture outlines that I was able to dig up. It looks like I was starting small, just porting over a few of the demuxers and decoders that I knew well.I’m wondering if it would still be as straightforward to separate out such components now, more than 13 years later ?
The post Writing A Dreamcast Media Player first appeared on Breaking Eggs And Making Omelettes.
-
New proposed ePrivacy Regulation and why Piwik might not need tracking consent compared to Google Analytics & co
11 janvier 2017, par InnoCraft — CommunityThe EU is proposing new ePrivacy Regulations. The proposed Regulation on Privacy and Electronic Communications will increase the protection of people’s private life and open up new opportunities for business.
The new ePrivacy Regulation proposal
The proposal mentions several changes for example to the “Cookie Law” where no longer a cookie consent will be needed when the cookies improve the user’s internet experience, for example to remember the shopping cart history or when completing a form over several pages.
However, consent to track a user’s behaviour may be needed in the future, unless the analytics data collection is hosted on the first-party website.
From TheRegister : O’Neil noted a minor change in which visitors to a website for analytics purposes do not require consent, as long as any personal data collected is only processed by the first party.
First party Analytics respecting privacy
Piwik is an open-source analytics platform that is used on more than 1 million websites and apps in over 150 countries, and available in more than 50 languages. The difference with other analytics solutions is that you can download and install Piwik on your own infrastructure. Websites and mobile apps tracking users with their own Piwik very likely won’t require a consent from their users if these regulations become reality.
We have regularly written about why privacy matters, or more recently 11 ways Piwik Analytics helps you to protect your visitors privacy.
Besides the standard Piwik features, there are Premium Features that let businesses and organizations further maximize their success based on the tracked data. Need help in hosting Piwik on premise ? InnoCraft are THE Piwik experts and know it best as it is the company of the makers of Piwik. InnoCraft provides support subscriptions and enterprise packages to help you setting up, configuring and maintaining Piwik on your infrastructure as well as offer training and custom development.
We’re excited to be building the best digital analytics platform which respects our privacy on the Internet.
Thank you for being a valued member of the Piwik community !
-
FFMPEG not working from Python subprocess.Popen but works from command line
21 novembre 2017, par Stuart ClarkeI’m trying to run a
FFMPEG
script from withinpython 3.5.2
. theFFMPEG
command runs fine from the command line but fails within the python script.The function I use to execute the
FFMPEG
command isdef ffmpeg(args):
err = None
command = [
ffmpegcmd, '-y',
'-loglevel', loglevel
] + args
print("\n\n\n")
print(command)
print("\n\n\n")
print(" ".join(command))
ffmpeg = subprocess.Popen(command, stderr=subprocess.PIPE ,stdout=subprocess.PIPE, universal_newlines=True)
while err == None:
out, err = ffmpeg.communicate()
time.sleep(1)
if err and loglevel=='fatal':
print(" ".join(command))
raise Exception(err)
print(err)The value for args is :
['-i', '/var/www/temp/film.mp4', '-vf', 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black', '/var/www/temp/videoHD.mp4']
such that the resultant command being passed to
subprocess.Popen
is :['ffmpeg', '-y', '-loglevel', 'verbose', '-i', '/var/www/temp/film.mp4', '-vf', 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black', '/var/www/temp/videoHD.mp4']
The value of loglevel is
verbose
only for troubleshooting but is intended to run asfatal
. There are also someprint
commands only in place for troubleshooting.The reason for wanting to increase the resolution is so that it can be combined later with higher resolution videos.
The result when running from within
python
is :ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version='2~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[h264 @ 0x7f741a37a560] Reinit context to 640x368, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x7f741a3bc700] Reinit context to 640x368, pix_fmt: yuv420p
[graph_1_in_0_1 @ 0x7f741a5315e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[Parsed_scale_0 @ 0x7f741a54e000] w:1920 h:1080 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0x7f741a54f6a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
[Parsed_scale_0 @ 0x7f741a54e000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
[Parsed_pad_1 @ 0x7f741a54eac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
[libx264 @ 0x7f741a5509e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7f741a5509e0] profile High, level 4.0
[libx264 @ 0x7f741a5509e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/www/temp/videoHD.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.89.100 aacThis results in a file with no content.
When I run the command from the command line I need to add single quotes around the
-vf
video filtersscale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black
so the whole command becomes :ffmpeg -y -loglevel verbose -i /var/www/temp/film.mp4 -vf 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black' /var/www/temp/videoHD.mp4
Running this command gives the required result.
ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version='2~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[h264 @ 0x7f3a55c17560] Reinit context to 640x368, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x7f3a55c59700] Reinit context to 640x368, pix_fmt: yuv420p
[graph_1_in_0_1 @ 0x7f3a55dce5e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[Parsed_scale_0 @ 0x7f3a55deb000] w:1920 h:1080 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0x7f3a55dec6a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
[Parsed_scale_0 @ 0x7f3a55deb000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
[Parsed_pad_1 @ 0x7f3a55debac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
[libx264 @ 0x7f3a55ded9e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7f3a55ded9e0] profile High, level 4.0
[libx264 @ 0x7f3a55ded9e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/www/temp/videoHD.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.89.100 aac
frame= 46 fps=0.0 q=0.0 size= 0kB time=00:00:01.62 bitrate= 0.0kbits/s
frame= 59 fps= 47 q=29.0 size= 116kB time=00:00:02.04 bitrate= 464.8kbits/
frame= 74 fps= 41 q=29.0 size= 223kB time=00:00:02.56 bitrate= 714.8kbits/
frame= 87 fps= 35 q=29.0 size= 344kB time=00:00:02.98 bitrate= 942.4kbits/
frame= 98 fps= 33 q=29.0 size= 427kB time=00:00:03.34 bitrate=1043.4kbits/
blah
blah
blah
frame=11347 fps= 21 q=29.0 size= 97550kB time=00:06:18.32 bitrate=2112.3kbits/
frame=11363 fps= 21 q=29.0 size= 97713kB time=00:06:18.85 bitrate=2112.8kbits/
frame=11380 fps= 21 q=29.0 size= 97795kB time=00:06:19.41 bitrate=2111.5kbits/
No more output streams to write to, finishing.
frame=11392 fps= 21 q=-1.0 Lsize= 98519kB time=00:06:19.77 bitrate=2125.1kbits/s speed=0.69x
video:92124kB audio:5986kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.416313%
Input file #0 (/var/www/temp/film.mp4):
Input stream #0:0 (video): 11392 packets read (14892948 bytes); 11392 frames decoded;
Input stream #0:1 (audio): 17803 packets read (6112540 bytes); 17802 frames decoded (18229248 samples);
Total: 29195 packets (21005488 bytes) demuxed
Output file #0 (/var/www/temp/videoHD.mp4):
Output stream #0:0 (video): 11392 frames encoded; 11392 packets muxed (94334785 bytes);
Output stream #0:1 (audio): 17802 frames encoded (18229248 samples); 17803 packets muxed (6129981 bytes);
Total: 29195 packets (100464766 bytes) muxed
[libx264 @ 0x7f3a55ded9e0] frame I:74 Avg QP:19.08 size: 51540
[libx264 @ 0x7f3a55ded9e0] frame P:3506 Avg QP:21.34 size: 19348
[libx264 @ 0x7f3a55ded9e0] frame B:7812 Avg QP:24.07 size: 2904
[libx264 @ 0x7f3a55ded9e0] consecutive B-frames: 1.3% 20.2% 4.6% 73.9%
[libx264 @ 0x7f3a55ded9e0] mb I I16..4: 19.7% 73.6% 6.7%
[libx264 @ 0x7f3a55ded9e0] mb P I16..4: 3.2% 6.4% 0.1% P16..4: 52.5% 7.6% 2.6% 0.0% 0.0% skip:27.6%
[libx264 @ 0x7f3a55ded9e0] mb B I16..4: 0.2% 0.2% 0.0% B16..8: 23.2% 0.4% 0.0% direct: 0.5% skip:75.5% L0:51.8% L1:46.6% BI: 1.6%
[libx264 @ 0x7f3a55ded9e0] 8x8 transform intra:66.4% inter:94.0%
[libx264 @ 0x7f3a55ded9e0] coded y,uvDC,uvAC intra: 33.6% 53.4% 7.3% inter: 5.3% 14.2% 0.0%
[libx264 @ 0x7f3a55ded9e0] i16 v,h,dc,p: 22% 27% 5% 46%
[libx264 @ 0x7f3a55ded9e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 20% 4% 7% 7% 7% 5% 4%
[libx264 @ 0x7f3a55ded9e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 28% 11% 3% 9% 7% 6% 3% 2%
[libx264 @ 0x7f3a55ded9e0] i8c dc,h,v,p: 49% 21% 20% 10%
[libx264 @ 0x7f3a55ded9e0] Weighted P-Frames: Y:0.5% UV:0.1%
[libx264 @ 0x7f3a55ded9e0] ref P L0: 63.4% 8.9% 21.4% 6.3% 0.0%
[libx264 @ 0x7f3a55ded9e0] ref B L0: 89.3% 9.1% 1.6%
[libx264 @ 0x7f3a55ded9e0] ref B L1: 98.1% 1.9%
[libx264 @ 0x7f3a55ded9e0] kb/s:1987.38
[aac @ 0x7f3a55deee80] Qavg: 1160.814and the resulting video is fine.
Any ideas ?
Cheers,
Stu
Edit
It was suggested that I use a new function to do much the same thing. So I added the following function and used it for the command that I’m having trouble with :
def ffmpegPro(args):
err = None
for i, arg in enumerate(args):
if(" " in arg or "(" in arg or "[" in arg):
args[i] = "\"" + arg + "\""
command = [
ffmpegcmd, '-y',
'-loglevel', loglevel
] + args
commandStr = " ".join(command)
print("\n\n\n")
print(command)
print("\n\n\n")
print(commandStr)
ffmpeg = subprocess.Popen(commandStr, stderr=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True, shell=True)
while err == None:
out, err = ffmpeg.communicate()
time.sleep(1)
if ffmpeg.returncode == 0 and all([os.path.exists(f) for f in (videoStorage['data_small'], videoStorage['data_big'])]):
print("Job done.")
else:
print("ERROR")
print(err)The resulting command can now be used in
python
or at the command line without needing to be changed at all. The command is :ffmpeg -y -loglevel verbose -i /var/www/temp/film.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:x=(1920-iw)/2:y=(1080-ih)/2:color=black" /var/www/temp/videoHD.mp4
The result when executed in
python
isffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version='2~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[h264 @ 0x7fb75053d560] Reinit context to 640x368, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x7fb75057f700] Reinit context to 640x368, pix_fmt: yuv420p
[graph_1_in_0_1 @ 0x7fb7506f45e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[Parsed_scale_0 @ 0x7fb750711000] w:1920 h:1080 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0x7fb7507126a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
[Parsed_scale_0 @ 0x7fb750711000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
[Parsed_pad_1 @ 0x7fb750711ac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
[libx264 @ 0x7fb7507139e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fb7507139e0] profile High, level 4.0
[libx264 @ 0x7fb7507139e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/www/temp/videoHD.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.89.100 aac
KilledNote the
Killed
at the end. Is this significant and why is it only happening when executed in the script ?Here is the output from the command line which results in a successful video file.
ffmpeg version 3.3.4-2~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version='2~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[h264 @ 0x7fb52cfb3560] Reinit context to 640x368, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/temp/film.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 00:06:19.80, start: 0.000000, bitrate: 451 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 640x358 (640x368), 313 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x7fb52cff5700] Reinit context to 640x368, pix_fmt: yuv420p
[graph_1_in_0_1 @ 0x7fb52d16a5e0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[Parsed_scale_0 @ 0x7fb52d187000] w:1920 h:1080 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0x7fb52d1886a0] w:640 h:358 pixfmt:yuv420p tb:1/15360 fr:30/1 sar:0/1 sws_param:flags=2
[Parsed_scale_0 @ 0x7fb52d187000] w:640 h:358 fmt:yuv420p sar:0/1 -> w:1920 h:1074 fmt:yuv420p sar:0/1 flags:0x4
[Parsed_pad_1 @ 0x7fb52d187ac0] w:1920 h:1074 -> w:1920 h:1080 x:0 y:2 color:0x000000FF
[libx264 @ 0x7fb52d1899e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fb52d1899e0] profile High, level 4.0
[libx264 @ 0x7fb52d1899e0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/www/temp/videoHD.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Stream #0:0(und): Video: h264 (libx264), 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.89.100 aac
frame= 47 fps=0.0 q=0.0 size= 0kB time=00:00:01.66 bitrate= 0.0kbits/s
frame= 59 fps= 41 q=29.0 size= 116kB time=00:00:02.04 bitrate= 464.8kbits/
frame= 71 fps= 35 q=29.0 size= 201kB time=00:00:02.45 bitrate= 671.3kbits/
frame= 80 fps= 31 q=29.0 size= 276kB time=00:00:02.75 bitrate= 822.0kbits/
Blah
Blah
Blah
frame=11337 fps= 21 q=29.0 size= 97503kB time=00:06:17.98 bitrate=2113.2kbits/
frame=11351 fps= 21 q=26.0 size= 97572kB time=00:06:18.45 bitrate=2112.1kbits/
frame=11371 fps= 21 q=29.0 size= 97745kB time=00:06:19.11 bitrate=2112.1kbits/
frame=11390 fps= 21 q=29.0 size= 97852kB time=00:06:19.73 bitrate=2111.0kbits/
No more output streams to write to, finishing.
frame=11392 fps= 21 q=-1.0 Lsize= 98519kB time=00:06:19.77 bitrate=2125.1kbits/s speed=0.688x
video:92124kB audio:5986kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.416313%
Input file #0 (/var/www/temp/film.mp4):
Input stream #0:0 (video): 11392 packets read (14892948 bytes); 11392 frames decoded;
Input stream #0:1 (audio): 17803 packets read (6112540 bytes); 17802 frames decoded (18229248 samples);
Total: 29195 packets (21005488 bytes) demuxed
Output file #0 (/var/www/temp/videoHD.mp4):
Output stream #0:0 (video): 11392 frames encoded; 11392 packets muxed (94334785 bytes);
Output stream #0:1 (audio): 17802 frames encoded (18229248 samples); 17803 packets muxed (6129981 bytes);
Total: 29195 packets (100464766 bytes) muxed
[libx264 @ 0x7fb52d1899e0] frame I:74 Avg QP:19.08 size: 51540
[libx264 @ 0x7fb52d1899e0] frame P:3506 Avg QP:21.34 size: 19348
[libx264 @ 0x7fb52d1899e0] frame B:7812 Avg QP:24.07 size: 2904
[libx264 @ 0x7fb52d1899e0] consecutive B-frames: 1.3% 20.2% 4.6% 73.9%
[libx264 @ 0x7fb52d1899e0] mb I I16..4: 19.7% 73.6% 6.7%
[libx264 @ 0x7fb52d1899e0] mb P I16..4: 3.2% 6.4% 0.1% P16..4: 52.5% 7.6% 2.6% 0.0% 0.0% skip:27.6%
[libx264 @ 0x7fb52d1899e0] mb B I16..4: 0.2% 0.2% 0.0% B16..8: 23.2% 0.4% 0.0% direct: 0.5% skip:75.5% L0:51.8% L1:46.6% BI: 1.6%
[libx264 @ 0x7fb52d1899e0] 8x8 transform intra:66.4% inter:94.0%
[libx264 @ 0x7fb52d1899e0] coded y,uvDC,uvAC intra: 33.6% 53.4% 7.3% inter: 5.3% 14.2% 0.0%
[libx264 @ 0x7fb52d1899e0] i16 v,h,dc,p: 22% 27% 5% 46%
[libx264 @ 0x7fb52d1899e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 19% 20% 4% 7% 7% 7% 5% 4%
[libx264 @ 0x7fb52d1899e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 28% 11% 3% 9% 7% 6% 3% 2%
[libx264 @ 0x7fb52d1899e0] i8c dc,h,v,p: 49% 21% 20% 10%
[libx264 @ 0x7fb52d1899e0] Weighted P-Frames: Y:0.5% UV:0.1%
[libx264 @ 0x7fb52d1899e0] ref P L0: 63.4% 8.9% 21.4% 6.3% 0.0%
[libx264 @ 0x7fb52d1899e0] ref B L0: 89.3% 9.1% 1.6%
[libx264 @ 0x7fb52d1899e0] ref B L1: 98.1% 1.9%
[libx264 @ 0x7fb52d1899e0] kb/s:1987.38
[aac @ 0x7fb52d18ae80] Qavg: 1160.814Any more ideas why this is being handled differently in
python
as opposed to the command line ?I’m believe this is a version issue and that is why the below answer did not work for me, things were fine before I upgraded but since then a lot of things have been playing up. I upgraded both
ffmpeg
andpython
versions and don’t really want to go back if it can be avoided.Thanks,
Stu