
Recherche avancée
Autres articles (87)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (10641)
-
ffmpeg - MXF with 4-channel audio : how to create proxies (high quality / small file size) and preserve the audio mapping
8 juillet 2018, par WhatsYourFunctionWe’ve got MXF sources (h.264 video at UHD (3840x2160) with 4-channels of (4 - PCM S24 mono sources)
We want Proxies — smallest file size at highest picture quality
The compression applied to the video and audio essences can be anything,
And the wrapper can be either MXF or QuickTime
but we need to preserve the audio mapping (i.e. the Proxy must be 4-channel audio)How to do that with ffmpeg ?
- EDIT Adding ffprobe :
Metadata :
uid : ***
generation_uid : ***
company_name : CANON
product_name : EOS C300 Mark II
product_version : 1.00
product_uid : ***
modification_date : 2018-06-28T08:29:24.000000Z
material_package_umid : ***
timecode : 02:50:31:17
Duration : 00:06:35.40, start : 0.000000, bitrate : 395842 kb/s
Stream #0:0 : Video : h264 (High 4:2:2 Intra), yuv422p10le(tv, progressive), 3840x2160, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23.98 tbn, 47.95 tbc
Metadata :
file_package_umid: ***
Stream #0:1 : Audio : pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata :
file_package_umid: ***
Stream #0:2 : Audio : pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata :
file_package_umid: ***
Stream #0:3 : Audio : pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata :
file_package_umid: ***
Stream #0:4 : Audio : pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
Metadata :
file_package_umid: ***
-
How to save animations with tight layout, transparency and in high quality
23 octobre 2023, par mapfI am trying to implement an option in my GUI to save an image sequence displayed using matplotlib. The code looks something like this :



import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import \
 FigureCanvasQTAgg as FigureCanvas
from matplotlib.animation import FuncAnimation
from PIL import Image


plt.rcParams['savefig.bbox'] = 'tight' 


class Printer:
 def __init__(self, data):
 self.fig, self.ax = plt.subplots()
 self.canvas = FigureCanvas(self.fig)

 # some irrelevant color adjustment here
 #self.ax.spines['bottom'].set_color('#f9f2d7')
 #self.ax.spines['top'].set_color('#f9f2d7')
 #self.ax.spines['right'].set_color('#f9f2d7')
 #self.ax.spines['left'].set_color('#f9f2d7')
 #self.ax.tick_params(axis='both', colors='#f9f2d7')
 #self.ax.yaxis.label.set_color('#f9f2d7')
 #self.ax.xaxis.label.set_color('#f9f2d7')
 #self.fig.subplots_adjust(left=0.1, right=0.975, bottom=0.09, top=0.98)
 self.fig.patch.set_alpha(0)
 self.fig.patch.set_visible(False)
 self.canvas.setStyleSheet("background-color:transparent;")
 self.fig.set_size_inches(10, 10, True)
 self.fig.tight_layout()

 self.data = data
 self.image_artist = self.ax.imshow(data[0])

 def animate(self, i):
 self.image_artist.set_data(self.data[i])
 self.canvas.draw()


def save_animation():
 data = [
 Image.open("test000.png"),
 Image.open("test001.png"),
 ]
 file = 'test.gif'
 printer = Printer(data)

 ani = FuncAnimation(
 printer.fig, printer.animate, interval=100, frames=len(data),
 )
 # writer = animation.writers['pillow'](bitrate=1000)
 ani.save(
 file, writer='pillow', savefig_kwargs={'transparent': True, 'bbox_inches': 'tight'}
 )


save_animation()




Transparency :



As you can see I have already tried several different approaches as suggested elsewhere (1, 2), but didn't manage to find a solution. All of the settings and arguments
patch.set_alpha(0)
,patch.set_visible(False)
,canvas.setStyleSheet("background-color:transparent;")
,savefig_kwargs={'transparent': True}
seem to have no effect at all on the transparency. I found this post but I didn't get the code to work (for one I had to comment out this%matplotlib inline
, but then I ended up getting some error during the MovieWriter.cleanupout = TextIOWrapper(BytesIO(out)).read() TypeError: a bytes-like object is required, not 'str'
). Here, it was suggested that this is actually a bug, but the proposed workaroud doesn't work for me since I would have to rely on third-party software. There also exists this bug report which was supposedly solved, so maybe it is unrelated.


Tight layout



I actually couldn't really find much on this, but all the things I tried (
plt.rcParams['savefig.bbox'] = 'tight'
,fig.tight_layout()
,savefig_kwargs={'bbox_inches': 'tight'}
) don't have any effect or are even actively discarded in the case of thebbox_inches argument
. How does this work ?


High quality



Since I cannot use
ImageMagick
and can't getffmpeg
to work (more on this below), I rely on pillow to save my animation. But the only argument in terms of quality that I can pass on seems to be thebitrate
, which doesn't have any effect. The files still have the same size and the animation still looks like mush. The only way that I found to increase the resolution was to usefig.set_size_inches(10, 10, True)
, but this still doesn't improve the overall quality of the animation. It still looks bad. I saw that you can pass oncodec
andextra_args
so maybe that is something that might help, but I have no idea how to use these because I couldn't find a list with allowed arguments.


ffmpeg



I can't get ffmpeg to work. I installed the python package from here and can import it into a python session but I don't know how I can get matplotlib to use that. I also got ffmpeg from here (Windows 64-bit version) and set the
plt.rcParams['animation.ffmpeg_path']
to where I saved the files (there was no intaller to run, not sure if I did it correctly). But this didn't help either. Also this is of course also third-party software, so if somebody else were to use my code/program it wouldn't work.

-
Passing long url as string in python subprocess
16 février 2015, par rogoroWhen I pass this long url as
subprocess.Popen(["ffmpeg", "-i",
"https://r6---sn-ufuxaxjvh-q4fe.googlevideo.com/videoplayback?pl=16&upn=1-Ch_dUO4YE&ipbits=0&requiressl=yes&sver=3&itag=22&ratebypass=yes&dur=86.053&source=youtube&sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&key=yt5&mime=video%2Fmp4&fexp=900805%2C907263%2C919150%2C927622%2C942901%2C943917%2C945089%2C947225%2C948124%2C948603%2C952302%2C952605%2C952612%2C952901%2C955301%2C957201%2C959701&expire=1424133614&id=o-ANRJvkk7EYBC4ug2L1u_aJ9BifNGN5wrOnqvWkhce-WT&mm=31&initcwndbps=5045000&signature=5DC013D85BE81A4EFFA9C7B9510865A5BB7E2121.3655C01D8075EAB4668D4AFB28C401896038470A&ip=137.144.99.102&ms=au&mv=m&mt=1424111820", "out.mp4"], stdout=subprocess.PIPE)It works.
But It doesn’t when I pass it as variable.
Example :link =
"the_above_long_string"
subprocess.Popen(["ffmpeg", "-i", link, "out.mp4"], stdout=subprocess.PIPE) // NOT WORKINGAny idea how to make it work ?
ERROR
ffmpeg version N-69659-gc0367f7 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 18.100 / 54. 18.100
libavcodec 56. 21.102 / 56. 21.102
libavformat 56. 19.100 / 56. 19.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 9.104 / 5. 9.104
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[tls @ 000000000033b9c0] The TLS connection was non-properly terminated.
https://r6---sn-ufuxaxjvh-q4fe.googlevideo.com/videoplayback?sver=3&ratebypass=yes&signature=BD4B6B18A9753B2B99F8C439FD1A7D809E866740.D3822A9D82D67A0F92908863E08F887A101B58A7&initcwndbps=5112500&ipbits=0&source=youtube&dur=86.053&itag=22&pl=16&mime=video%2Fmp4&fexp=907263%2C927622%2C934954%2C9406738%2C9406963%2C943917%2C947225%2C948124%2C952302%2C952605%2C952612%2C952901%2C955301%2C957201%2C959701&mm=31&requiressl=yes&mt=1424116526&mv=m&ms=au&ip=137.144.99.102&key=yt5&upn=6MJQ3GrpFkA&expire=1424138291&sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&id=o-AGbNQ-s1alKbG-j05uoGOvT4MMeDv3qdgMqWZu-vGap9
: Input/output error