
Recherche avancée
Autres articles (57)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
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 -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (11269)
-
Merging audio at specific time with ffmpeg
19 octobre 2015, par DeepuI was trying to merge audio with ffmpeg with the following command but the audio is merging at starting point.
ffmpeg -i output-1146.mp4 -i org-EOLWAudio.mp3 -filter_complex " [0:a]atrim=start=0,asetpts=PTS-STARTPTS[aud1]; [1:a]atrim=0:250,asetpts=PTS+100/TB[aud2]; [aud1][aud2]amix=inputs=2[aout]" -map 0:v -map "[aout]" -crf 24 -pix_fmt yuv420p -c:v libx264 -c:a aac -strict -2 -ac 2 output-1246.mp4
With this command it is merging audio streams but not specified point of time.
I want to merge audio of a mp3 file from 0 to 250 seconds audio to video
Starting at 4th minute to 8.10 minute.Output :
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --arch=x86_64 --optflags='-02 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --[aram=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --enable-runtime-cpudetect
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output-1146.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.25.101
Duration: 00:15:03.80, start: 0.064000, bitrate: 212 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1366x768, 137 kb/s, 5 fps, 5 tbr, 10240 tbn, 10 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, stereo, fltp, 116 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, mp3, from 'org-EOLWAudio.mp3':
Metadata:
novideocodec : 0
server : Red5
creationdate : Wed Sep 23 15:51:29 IST 2015
canSeekToEnd : true
encoder : Lavf56.25.101
Duration: 00:14:00.74, start: 0.069063, bitrate: 48 kb/s
Stream #1:0: Audio: mp3, 16000 Hz, stereo, s16p, 48 kb/s
[libx264 @ 0x9d67440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x9d67440] profile High, level 3.2
[libx264 @ 0x9d67440] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=24.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 -
Linking problems using CMake
5 décembre 2013, par ZoellickI'm writing an application containig 2 internal libraries and depends on more 2 external libraries (ffmpeg and opencv). I'm also using CMake to produce UNIX makefiles. And the problem is when i'm trying to build sources, it compiles but don't link with ffmpeg at all and the next output the linker gives :
../../Decoder/libDecoder.a(ConverterAVFrameToRGB.cpp.o): In function `FaceVideo::ConverterAVFrameToRGB::to_rgb_conversion(std::vector >&, int, int, int)':
ConverterAVFrameToRGB.cpp:(.text+0x990): undefined reference to `av_frame_free'
../../Decoder/libDecoder.a(FfmpegDecoder.cpp.o): In function `FaceVideo::FfmpegDecoder::destroy()':
FfmpegDecoder.cpp:(.text+0xa30): undefined reference to `av_frame_free'
../../Decoder/libDecoder.a(FfmpegDecoder.cpp.o): In function `FaceVideo::FfmpegDecoder::decode_next_chunk(int)':
FfmpegDecoder.cpp:(.text+0xb6b): undefined reference to `av_frame_clone'
FfmpegDecoder.cpp:(.text+0xc13): undefined reference to `av_frame_free'
../../Decoder/libDecoder.a(FfmpegEncoder.cpp.o): In function `FaceVideo::FfmpegEncoder::destroy()':
FfmpegEncoder.cpp:(.text+0x132): undefined reference to `avcodec_free_frame'
../../Decoder/libDecoder.a(FfmpegEncoder.cpp.o): In function `FaceVideo::FfmpegEncoder::encode()':
FfmpegEncoder.cpp:(.text+0x4c4): undefined reference to `avcodec_encode_video2'
FfmpegEncoder.cpp:(.text+0x592): undefined reference to `avcodec_encode_video2'
../../Decoder/libDecoder.a(FrameSaver.cpp.o): In function `FaceVideo::FrameSaver::saver(std::vector >&, int, int, int)':
FrameSaver.cpp:(.text+0x869): undefined reference to `av_frame_free'
collect2: ld returned 1 exit statusThat's excatly what i don't want to see.
There are three Cmake files : two for internal libraries (use
add_library(Decoder ${SOURCES_DECODER})
and
add_library(Detector ${SOURCES_DETECTOR})in them) and one for main executable (use
add_executable(Tool ${SOURCES_TOOL})
and
target_link_libraries (Tool Decoder avutil avcodec swscale avformat Detector ${OpenCV_LIBS})in it).
As far as i understand from CMake manuals and examples, this should make linker link this libraries together, but no effect.
I've been trying lot of things such as :
1) Addinglink_directories()
with path to libraries (/usr/lib/x86_64-linux-gnu/ for me) wherever it's possile, nothing changed.
2) Linking every library separately, i mean i tried do something like this in my internal libraries CMake files :target_link_libraries (Decoder avutil avcodec swscale avformat)
. And then link library together into my Tool CMake file :target_link_libraries (Tool Decoder Detector)
.
3) Editing output makefiles.
4) Compiling simple one-file application just to test whether i can do it or not. I can.g++ -lavcodec -o out mysource.cpp
works perfectly.
5) Compling ffmpeg manually and installing it.The fact is i realy don't know what should i do. I have no idea. And i would very appreciate your every answer.
Output when CMAKE_VERBOSE_MAKEFILE is set
!
/usr/bin/c++ -march=x86-64 -Wall -fPIC -pthread -std=c++0x -D__STDC_CONSTANT_MACROS -march=x86-64 -fPIC CMakeFiles/FaceDetectorTool.dir/home/anton/Programming/facevideo/branches/Stream_Prototype/src/tools/FaceDetectorTool/facedetector.cpp.o -o FaceDetectorTool -rdynamic ../../Detector/libDetector.a ../../Decoder/libDecoder.a -lavutil -lavcodec -lswscale -lavformat /usr/local/lib/libopencv_videostab.so.2.4.7 /usr/local/lib/libopencv_video.so.2.4.7 /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_superres.so.2.4.7 /usr/local/lib/libopencv_stitching.so.2.4.7 /usr/local/lib/libopencv_photo.so.2.4.7 /usr/local/lib/libopencv_ocl.so.2.4.7 /usr/local/lib/libopencv_objdetect.so.2.4.7 /usr/local/lib/libopencv_nonfree.so.2.4.7 /usr/local/lib/libopencv_ml.so.2.4.7 /usr/local/lib/libopencv_legacy.so.2.4.7 /usr/local/lib/libopencv_imgproc.so.2.4.7 /usr/local/lib/libopencv_highgui.so.2.4.7 /usr/local/lib/libopencv_gpu.so.2.4.7 /usr/local/lib/libopencv_flann.so.2.4.7 /usr/local/lib/libopencv_features2d.so.2.4.7 /usr/local/lib/libopencv_core.so.2.4.7 /usr/local/lib/libopencv_contrib.so.2.4.7 /usr/local/lib/libopencv_calib3d.so.2.4.7 -ldl -lm -lpthread -lrt /usr/local/lib/libopencv_nonfree.so.2.4.7 /usr/local/lib/libopencv_ocl.so.2.4.7 /usr/local/lib/libopencv_gpu.so.2.4.7 /usr/local/lib/libopencv_photo.so.2.4.7 /usr/local/lib/libopencv_objdetect.so.2.4.7 /usr/local/lib/libopencv_legacy.so.2.4.7 /usr/local/lib/libopencv_video.so.2.4.7 /usr/local/lib/libopencv_ml.so.2.4.7 /usr/local/lib/libopencv_calib3d.so.2.4.7 /usr/local/lib/libopencv_features2d.so.2.4.7 /usr/local/lib/libopencv_highgui.so.2.4.7 /usr/local/lib/libopencv_imgproc.so.2.4.7 /usr/local/lib/libopencv_flann.so.2.4.7 /usr/local/lib/libopencv_core.so.2.4.7 -Wl,-rpath,/usr/local/lib -
How to split an audio / video file based upon multiple timestamps by using FFMPEG (preferably)
19 février, par badr2001I would like to be able to split my audio (mp3 or equiv.) or video file based upon multiple timestamps. The same way, for those who have used any editing software, you can crop the file based upon selecting a start time and end time.


What I have done so far :


[HttpPost]
public async Task<string> ProcessFullAudio([FromBody] ProcessFullAudioRequest processFullAudioRequest)
{
 if (processFullAudioRequest == null || processFullAudioRequest.StartEndTimes == null || processFullAudioRequest.StartEndTimes.Length == 0)
 {
 throw new ArgumentException("Invalid request: StartEndTimes cannot be null or empty.");
 }

 var timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
 var fileName = $"{Guid.NewGuid()}_{timestamp}.mp3";
 var outputFilePath = Path.Combine(customFolder, fileName);

 int amntOfTimeStamps = processFullAudioRequest.StartEndTimes.Length;
 int step = 0;
 string lineOfCodeForFirstTime = " \"aselect='not(between(t,<start>,<end>)";
 string lineOfCodeForRestOfTimes = "+between(t,<start>,<end>)";
 string argument = "";
 string result = null;
 string filterComplex = GenerateAtrims(processFullAudioRequest.StartEndTimes);

 while (step != amntOfTimeStamps)
 {
 step++;
 if (step == 1)
 {
 result = ReplacePlaceholders(lineOfCodeForFirstTime, HhMmSsToSeconds(processFullAudioRequest.StartEndTimes[step - 1].Start).ToString() , HhMmSsToSeconds(processFullAudioRequest.StartEndTimes[step - 1].End).ToString());
 argument += result;
 }
 else
 {
 result = ReplacePlaceholders(lineOfCodeForRestOfTimes, HhMmSsToSeconds(processFullAudioRequest.StartEndTimes[step - 1].Start).ToString() , HhMmSsToSeconds(processFullAudioRequest.StartEndTimes[step - 1].End).ToString());
 argument += result;
 }

 }
 var FFMPEG_PATH = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "ffmpeg.exe");
 if (!System.IO.File.Exists(FFMPEG_PATH))
 {
 return "ffmpeg.exe IS NULL";
 }
 var arguments = $"-i {processFullAudioRequest.InputFilePath} -af {argument})' ,asetpts=N/SR/TB\" -acodec libmp3lame {outputFilePath}";

 await ProcessAsyncHelper.ExecuteShellCommand(FFMPEG_PATH, arguments, Timeout.Infinite);

 return outputFilePath;
}
</end></start></end></start></string>


The code, I hope, is self explanatory.
The argument variable should like something like this :


-i C:\Users\User\Desktop\AudioEditorBackEnmd\AudioEditorAPI\wwwroot\mp3\TestAudio_123.mp3 -af "aselect='not(between(t,120,240))' ,asetpts=N/SR/TB" -acodec libmp3lame C:\Users\User\Desktop\AudioEditorBackEnmd\AudioEditorAPI\wwwroot\mp3\aa887f21-0a90-4ec5-80ba-2b265cb445b4_20250219_123804.mp3



After returning the output path for the newly processed edited audio, I pass it to my DownloadFile function :


[HttpGet]
 public async Task<iactionresult> DownloadProcessedFile([FromQuery] string fileName)
 {
 if (string.IsNullOrWhiteSpace(fileName))
 {
 return BadRequest("File name is required.");
 }

 var filePath = Path.Combine(customFolder, fileName);

 if (!System.IO.File.Exists(filePath))
 {
 return NotFound(new { fileName });
 }

 try
 {
 var fileBytes = await System.IO.File.ReadAllBytesAsync(filePath);

 return File(fileBytes, "audio/mpeg", fileName);

 }
 catch (Exception ex)
 {
 throw;
 }

 }

</iactionresult>


Everything works, in the sense off, I am able to get an processed file which is shorter than the original audio. However the issue is that the timestamps are off.
For example, in the argument that I provided above, I am cropping the audio from 120 to 240, which is from the 2 min mark till the 4 min mark. The audio which I am passing is 01:06:53 however the processed audio gives me back 1:05:22 which is not excepted as I should be getting 01:04:53.


The annoying thing is that I was getting the desired output at one point. Im not sure what changes caused the timestamps to become off. The only changes which I did was changing the file locations to my wwwroot folder.


I have tried many different variations of commands to get a desired output but can't seem to get anything close - I always get 1:05:22 back. From the commands that I tired was :


var arguments = $"-i {processFullAudioRequest.InputFilePath} -af {argument})' , asetpts=N/SR/TB\" -c:a libmp3lame -q:a 2 {outputFilePath}";



I tried so many more but I simply can't remember. And now I feel like I have reached a hard wall in coming up with a solution for this.


Any help I would much appreciate. I have tried to give as much detail as I can but if anything remains please let me know.