
Recherche avancée
Autres articles (67)
-
Qu’est ce qu’un éditorial
21 juin 2013, parEcrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
Vous pouvez personnaliser le formulaire de création d’un éditorial.
Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...) -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.
Sur d’autres sites (6696)
-
FOR FFMPEQ CODE LIVE [on hold]
20 août 2017, par Trung lêOne user live streaming and he used ffmpeg with 1 pc : 1core,1GB ram AND LIVE WITH 20 threads EVENTS ON YOUTUBE @@ unbelievable . i would like need "code live", can i help you ? tks very much
https://ffmpeg.org/documentation.html -
Different code(.java file) for different platform ?
2 mars 2016, par AR792I have a code where image data is passed from bitmap to FFmpeg frame recorder and converted to a video. But i need to make small changes while running it on LG G3(armv7) from Asus zenfone 5(x86).
Following are the class variables that create the issue :(declared under, class Main Activity)
inputWidth = 1024 ;
inputHeight = 650 ;
Following is the method where the issue occurs :
byte [] getNV21(int inputWidth, int inputHeight, Bitmap bitmap) {
int [] argb = new int[inputWidth * inputHeight];
bitmap.getPixels(argb, 0, inputWidth, 0, 0, inputWidth, inputHeight);
byte [] yuv = new byte[inputWidth*inputHeight*3/2];
encodeYUV420SP(yuv, argb, inputWidth, inputHeight);
return yuv;
}
void encodeYUV420SP(byte[] yuv420sp, int[] argb, int width, int height) {
final int frameSize = width * height;
int yIndex = 0;
int uvIndex = frameSize;
int a, R, G, B, Y, U, V;
int index = 0;
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
a = (argb[index] & 0xff000000) >> 24; // a is not used obviously
R = (argb[index] & 0xff0000) >> 16;
G = (argb[index] & 0xff00) >> 8;
B = (argb[index] & 0xff) >> 0;
// well known RGB to YUV algorithm
Y = ( ( 66 * R + 129 * G + 25 * B + 128) >> 8) + 16;
U = ( ( -38 * R - 74 * G + 112 * B + 128) >> 8) + 128;
V = ( ( 112 * R - 94 * G - 18 * B + 128) >> 8) + 128;
// NV21 has a plane of Y and interleaved planes of VU each sampled by a factor of 2
// meaning for every 4 Y pixels there are 1 V and 1 U. Note the sampling is every other
// pixel AND every other scanline.
yuv420sp[yIndex++] = (byte) ((Y < 0) ? 0 : ((Y > 255) ? 255 : Y));
if (j % 2 == 0 && index % 2 == 0) {
yuv420sp[uvIndex++] = (byte)((V<0) ? 0 : ((V > 255) ? 255 : V));
yuv420sp[uvIndex++] = (byte)((U<0) ? 0 : ((U > 255) ? 255 : U));
}
index ++;
}
}
}Working CODE :
LG G3 :I can use the above variables at any place in the code to get the required output.
Bitmap size returned = 2734200Asus Zenfone 5 : Except at creating the bitmap, I have to use everywhere else bitmap.getHeight() and bitmap.getWidth(), to get the required output.
Surprisingly here Bitmap size returned = 725760 (So its not setting according to set bitmap parameters ?)
INCORRECT CODE :
LG G3 : IF i use bitmap.getHeight() and bitmap.getWidth(), i get java.lang.ArrayIndexOutOfBoundsException : length = 102354 , index = 102354. @getNV21 method
Asus Zenfone 5 : If i use inputWidth , inputHeight i get
java.lang.IllegalArgumentException : x + width must be <= bitmap.width() @getNV21 methodHow can i generalize the above code for both phones ?
-
When I run code in Docker I get a Django error [Errno 2]. When running locally everything works. Why ?
8 février 2021, par Bartłomiej KokoszkaI don't know what's going on. A script run by Django works fine, but not through Docker and Django. An error is returned :


Pic Errno 2 No such file or directory


Below is the code of the function with the error and the code of the Dockerfile.


'''


def mediainfo(filepath):
 



Original code :




prober = get_prober_name()
 command_args = [
 "-v", "quiet",
 "-show_format",
 "-show_streams",
 filepath
 ]

 command = [prober, '-of', 'old'] + command_args





Modified code :




command = f"ffprobe -v error -show_format -show_streams -select_streams v:0 {filepath}"





The rest of the functions :


res = Popen(command, stdout=PIPE)
 output = res.communicate()[0].decode("utf-8")

 if res.returncode != 0:
 output = Popen(command, stdout=PIPE).communicate()[0].decode("utf-8")

 rgx = re.compile(r"(?:(?P.*?):)?(?P<key>.*?)\=(?P<value>.*?)$")
 info = {}

 if sys.platform == 'win32':
 output = output.replace("\r", "")

 for line in output.split("\n"):
 # print(line)
 mobj = rgx.match(line)

 if mobj:
 # print(mobj.groups())
 inner_dict, key, value = mobj.groups()

 if inner_dict:
 try:
 info[inner_dict]
 except KeyError:
 info[inner_dict] = {}
 info[inner_dict][key] = value
 else:
 info[key] = value

 return info
</value></key>


'''


Code of the Dockerfile


'''


FROM python:3.7 as base

EXPOSE 80

WORKDIR /app
COPY . /app


ENV PYTHONDONTWRITEBYTECODE=1

ENV PYTHONUNBUFFERED=1

RUN pip install --upgrade pip
RUN echo 'deb http://deb.debian.org/debian buster-backports main contrib non-free' >> /etc/apt/sources.list
RUN apt-get update

RUN apt-get -y install ffmpeg
RUN apt-get update

COPY requirements.txt .
RUN python -m pip install -r requirements.txt

FROM base as prod

ENTRYPOINT ["python","manage.py","runserver","0.0.0.0:80"]



'''