
Recherche avancée
Autres articles (63)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Installation en mode ferme
4 février 2011, parLe mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
C’est la méthode que nous utilisons sur cette même plateforme.
L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)
Sur d’autres sites (12418)
-
Using ffmpeg dll's from a windows 32 bit app
8 avril 2020, par DerekI am trying to use ffmpeg via dll calls from a win32 app (compiled in clarion)



I transcoded the example file encode_video.c and that worked 100% however I was left with a .h264 file instead of a .mp4 file.



I then transcoded the example muxing.c however it crashes and I am at a loss for options.



Any help would be most appreciated.



Encode_mp4 ROUTINE
! avformat_alloc_output_context2 *******************************************************************************************
file_name = 'myvideo.mp4'
! Try guess format from filename
if CHECK_STACK then ds_SaveStack .
Result = avformat_alloc_output_context2(ThisPtrPtr, 0, NullCString, file_name);
if CHECK_STACK then ds_TestStack .
if Result < 0
 ds_OutputDebugString('avformat_alloc_output_context2 Try guess format failed, try mpeg', TRUE)
 CString1 = 'mpeg'
 if CHECK_STACK then ds_SaveStack .
 Result = avformat_alloc_output_context2(ThisPtrPtr, 0, CString1, file_name);
 if CHECK_STACK then ds_TestStack .
 if Result < 0
 ds_OutputDebugString('avformat_alloc_output_context2 failed', TRUE)
 stop('Could not allocate output format context')
 exit
 end
end
formater_ctxt &= (ThisPtrPtr)
!ds_OutputDebugString('formater_ctxt=' & address(formater_ctxt), TRUE)
assert(not(formater_ctxt &= NULL), 'Check AVFormatContext formater_ctxt')
do VerifyFormatContext
assert(formater_ctxt.oformat > 0, 'Check AVFormatContext formater_ctxt.oformat')
formater &= (formater_ctxt.oformat)
do VerifyFormat
ds_OutputDebugString('avformat_alloc_output_context2 OK', TRUE)

! avcodec_find_encoder *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
encoder &= avcodec_find_encoder(formater.video_codec)
if CHECK_STACK then ds_TestStack .
if encoder &= NULL
 ds_OutputDebugString('avcodec_find_encoder failed', TRUE)
 stop('Could not find encoder')
 exit
end
do VerifyEncoder
ds_OutputDebugString('avcodec_find_encoder OK', TRUE)

! avformat_new_stream *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
stream &= avformat_new_stream(formater_ctxt, encoder)
if CHECK_STACK then ds_TestStack .
if stream &= NULL 
 ds_OutputDebugString('avformat_new_stream failed', TRUE)
 stop('Could not create new stream')
 exit
end
do VerifyStream
stream.id = formater_ctxt.nb_streams-1
ds_OutputDebugString('avformat_new_stream OK', TRUE)

! avcodec_alloc_context3 *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
encoder_ctxt &= avcodec_alloc_context3(encoder)
if CHECK_STACK then ds_TestStack .
if encoder_ctxt &= NULL 
 ds_OutputDebugString('avcodec_alloc_context3 failed', TRUE)
 stop('Could not allocate video codec context')
 exit
end
do VerifyEncoderContext
ds_OutputDebugString('avcodec_alloc_context3 OK', TRUE)

! Video settings *******************************************************************************************
do InitVideoSettings

assert(AV_CODEC_FLAG_GLOBAL_HEADER = bshift(1, 22), 'Check AV_CODEC_FLAG_GLOBAL_HEADER')
if band(formater.flags, AVFMT_GLOBALHEADER)
 encoder_ctxt.flags = bor(encoder_ctxt.flags, AV_CODEC_FLAG_GLOBAL_HEADER) !avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
end

! avcodec_open2 *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
Result = avcodec_open2(encoder_ctxt, encoder, 0)
if CHECK_STACK then ds_TestStack .
if Result < 0
 ds_OutputDebugString('avcodec_open2 failed. Result=' & Result, TRUE)
 stop('Could not open codec')
 exit
end
ds_OutputDebugString('avcodec_open2 OK', TRUE)

! av_frame_alloc *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
frame &= av_frame_alloc();
if CHECK_STACK then ds_TestStack .
if frame &= NULL
 ds_OutputDebugString('av_frame_alloc failed', TRUE)
 stop('Could not allocate video frame')
 exit
end
do VerifyFrame
frame.format = encoder_ctxt.pix_fmt
frame.width = encoder_ctxt.width
frame.height = encoder_ctxt.height
ds_OutputDebugString('av_frame_alloc OK', TRUE)

! av_frame_get_buffer *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
Result = av_frame_get_buffer(frame, 32)
if CHECK_STACK then ds_TestStack .
if Result < 0
 ds_OutputDebugString('av_frame_get_buffer failed', TRUE)
 stop('Could not allocate video frame buffer Error = ' & Result)
 exit
end
do VerifyFrameBuffer
ds_OutputDebugString('av_frame_get_buffer OK', TRUE)

!frame->data offset=0 Array[8] of *int8_t
UseData0 &= (frame.data[1])
UseData1 &= (frame.data[2])
UseData2 &= (frame.data[3])

if CHECK_STACK then ds_SaveStack .
Result = avcodec_parameters_from_context(stream.codecpar, encoder_ctxt);
if CHECK_STACK then ds_TestStack .
if Result < 0
 ds_OutputDebugString('avcodec_parameters_from_context failed', TRUE)
 stop('Could not initialize stream parameters')
 exit
end
ds_OutputDebugString('avcodec_parameters_from_context OK', TRUE)

! av_dump_format *******************************************************************************************
ds_OutputDebugString('before call to av_dump_format file_name=' & file_name, TRUE)
av_dump_format(formater_ctxt, 0, file_name, 1)




I get a crash at last line - call to av_dump_format()



If I comment this code then I get a crash on the very next lib call :



! avio_open *******************************************************************************************
if not(band(formater.flags, AVFMT_NOFILE)) 
 ds_OutputDebugString('before call to avio_open file_name=' & file_name, TRUE)
 ThisInt &= address(formater_ctxt.pb)
 Result = avio_open(ThisInt, file_name, AVIO_FLAG_WRITE)




Strangely if I comment the setup call to av_log_set_callback(my_log_callback) then the crash moves down to the next lib call : avformat_write_header


-
find the timestamp of a sound sample of an mp3 with linux or python
23 juin 2020, par cardamomI am slowly working on a project which where it would be very useful if the computer could find where in an mp3 file a certain sample occurs. I would restrict this problem to meaning a fairly exact snippet of the audio, not just for example the chorus in a song on a different recording by the same band where it would become more some kind of machine learning problem. Am thinking if it has no noise added and comes from the same file, it should somehow be possible to locate the time at which it occurs without machine learning, just like grep can find the lines in a textfile where a word occurs.


In case you don't have an mp3 lying around, can set up the problem with some music available on the net which is in the public domain, so nobody complains :


curl https://web.archive.org/web/20041019004300/http://www.navyband.navy.mil/anthems/ANTHEMS/United%20Kingdom.mp3 --output godsavethequeen.mp3



It's a minute long :


exiftool godsavethequeen.mp3 | grep Duration
Duration : 0:01:03 (approx)



Now cut out a bit between 30 and 33 seconds (the bit which goes la la la la..) :


ffmpeg -ss 30 -to 33 -i godsavethequeen.mp3 gstq_sample.mp3



both files in the folder :


$ ls -la
-rw-r--r-- 1 cardamom cardamom 48736 Jun 23 00:08 gstq_sample.mp3
-rw-r--r-- 1 cardamom cardamom 1007055 Jun 22 23:57 godsavethequeen.mp3



This is what am after :


$ findsoundsample gstq_sample.mp3 godsavethequeen.mp3
start 30 end 33



Am happy if it is a bash script or a python solution, even using some kind of python library. Sometimes if you use the wrong tool, the solution might work but look horrible, so whichever tool is more suitable. This is a one minute mp3, have not thought yet about performance just about getting it done at all, but would like some scalability, eg find ten seconds somewhere in half an hour.


-
Recursively Convert FLAC to MP3 Keeping All Metadata and Located in Same Directory
6 juin 2020, par charlesstricklinI've got ffpeg installed on my Windows 10 PC and I'd like to recursively convert .flac music into .mp3 within the same directory (by that I mean the .flac file and the .mpg file end up in the same folder) and I'll be the first to admit I'm just a beginner to both ffmpeg and the CLI, so I'm a newbie there.



I've been looking at Recursively Converting FLAC to MP3 Using FFmpeg While Maintaining Metadata and Directory Structure on Windows as a possible answer to my question, but I do not want to copy from one volume to another.



Just to avoid confusion, my highest directory is C :\Users\User\Downloads\Music\ and I'd like to convert several artist/band's tracks from .flac to .mp3 within the same directory. C :\Users\User\Downloads\Music\1st Artist\1st CD\1st Track.flac would be converted to C :\Users\User\Downloads\Music\1st Artist\1st CD\1st Track.mp3, C :\Users\User\Downloads\Music\2nd Artist\1st CD\1st Track.flac would be converted to C :\Users\User\Downloads\Music\2nd Artist\1st CD\1st Track.mp3 and so on.



Would someone clue me in on the best way you know of to accomplish that from the CLI, please ?