
Recherche avancée
Autres articles (66)
-
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 (...) -
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 (...) -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
Sur d’autres sites (4331)
-
Save a Twilio of format 8Khz `mulaw` to a file
2 avril 2020, par JoeThere are a couple of posts that address the question, but I wasn't able to successfully playback a saved file. It usually plays back at half speed.



Convert 8kHz mulaw to 16KHz PCM in real time



Using the accepted answer in the above question, I saved the raw and base64 decoded the audio in go :



// Media event
type Media struct {
 Track string `json:"track"`
 Chunk string `json:"chunk"`
 Timestamp string `json:"timestamp"`
 Payload string `json:"payload"`
}

// SaveAudio will upgrade connection to websocket and save the audio to file
func SaveAudio(w http.ResponseWriter, r *http.Request) {
 utility.DebugLogf("SaveAudio")
 c, err := upgrader.Upgrade(w, r, nil)
 if err != nil {
 log.Print("upgrade:", err)
 return
 }

 defer utility.SafeClose(c)
 inBuf := bytes.Buffer{}

 loop := true
 for loop == true {
 _, message, err := c.ReadMessage()
 utility.PanicIfErr(err)
 decMessage := TwilioWSSMessage{}
 err = json.Unmarshal(message, &decMessage)
 utility.PanicIfErr(err)

 switch decMessage.Event {
 case "connected":
 utility.DebugLogf("Connected a %s protocol version:%s", decMessage.Protocol, decMessage.Version)
 case "start":
 utility.DebugLogf("Starting audio stream: %#v", decMessage.Start)
 case "media":
 chunk, err := base64.StdEncoding.DecodeString(decMessage.Media.Payload)
 utility.PanicIfErr(err)
 _, err = inBuf.Write(chunk)
 utility.PanicIfErr(err)
 case "stop":
 utility.DebugLogf("Ending audio stream: %#v", decMessage.Stop)
 loop = false
 default:
 utility.LogWarningf("Unrecognized event type: %s", decMessage.Event)
 loop = false
 }
 }

 saveRaw(&inBuf)
}

func saveRaw(buf *bytes.Buffer) {
 rawOut, err := os.Create("out.ulaw")
 utility.PanicIfErr(err)

 _, err = rawOut.Write(buf.Bytes())
 utility.PanicIfErr(err)
}




Then I used
ffmpeg
to convert frommulaw
to the defaultpcm_s16le
:


ffmpeg -f mulaw -ar 8000 -ac 1 -i out.ulaw mulaw_decoded.wav 




Then upsampled the audio from 8k->16k and play it with vlc :



ffmpeg -i mulaw_decoded.wav -ar 16000 upsampled.wav && vlc upsampled.wav




But it plays at half speed.



Ultimately I'd like to do it all in rust or go, but I can't even get it working locally with just ffmpeg.



Thanks in advance.





output of the above two
ffmpeg
operations combined with the suggested sox resampler :


cmd :



ffmpeg -y -loglevel verbose -f mulaw -ar 8000 -ac 1 -bits_per_raw_sample 8 -i testsamples/raw_mulaw_bytes -af aresample=resampler=soxr -ar 16000 upsampled.wav




output :



[mulaw @ 0x7fecc0814000] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, mulaw, from 'testsamples/raw_mulaw_bytes':
 Duration: 00:00:20.74, bitrate: 64 kb/s
 Stream #0:0: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
 Stream #0:0 -> #0:0 (pcm_mulaw (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[graph_0_in_0_0 @ 0x7fecc0505600] tb:1/8000 samplefmt:s16 samplerate:8000 chlayout:0x4
[Parsed_aresample_0 @ 0x7fecc0505280] ch:1 chl:mono fmt:s16 r:8000Hz -> ch:1 chl:mono fmt:s16 r:16000Hz
Output #0, wav, to 'upsampled.wav':
 Metadata:
 ISFT : Lavf58.29.100
 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s
 Metadata:
 encoder : Lavc58.54.100 pcm_s16le
No more output streams to write to, finishing.
size= 648kB time=00:00:20.74 bitrate= 256.0kbits/s speed=1.55e+03x
video:0kB audio:648kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.011753%
Input file #0 (testsamples/raw_mulaw_bytes):
 Input stream #0:0 (audio): 519 packets read (165920 bytes); 519 frames decoded (165920 samples);
 Total: 519 packets (165920 bytes) demuxed
Output file #0 (upsampled.wav):
 Output stream #0:0 (audio): 200 frames encoded (331840 samples); 200 packets muxed (663680 bytes);
 Total: 200 packets (663680 bytes) muxed
[AVIOContext @ 0x7fecc0433cc0] Statistics: 4 seeks, 6 writeouts
[AVIOContext @ 0x7fecc042a6c0] Statistics: 165920 bytes read, 0 seeks




The audio sounds the same as before


-
Start of video is not labeled as "0" in QuickTime Video from GoPro
26 mars 2020, par John TerragnoliI’m trying to combine four GoPro videos into a single video, and then rotate it 90 degrees. However, the time scales on the bottom of the videos are all wrong. The videos are 17 minutes and 42 second. But the beginning time is labeled as 5:15:20:32 and the ending time is 5:33:01:32. It just looks really weird and I’d like to fix it. After I use ffmpeg to rotate and concatenate the videos, the problem persists. Could it possibly be fixed with Exiftool ?
ffmpeg -safe 0 -f concat -i list.txt -vcodec copy -acodec copy merged_videos.MP4
ffmpeg -i input.mov -vf "transpose=1" output.mov
Here is the exiftool information on one of the videos :
File Name : GOPR3023.MP4
Directory : .
File Size : 3.7 GB
File Modification Date/Time : 2018:04:12 14:56:16-05:00
File Access Date/Time : 2020:03:25 12:17:18-05:00
File Inode Change Date/Time : 2020:03:25 17:57:04-05:00
File Permissions : rwxrwxrwx
File Type : MP4
File Type Extension : mp4
MIME Type : video/mp4
Major Brand : MP4 v1 [ISO 14496-1:ch13]
Minor Version : 2013.10.18
Compatible Brands : mp41
Movie Data Size : 4001979951
Movie Data Offset : 28
Movie Header Version : 0
Create Date : 2018:04:12 14:38:32
Modify Date : 2018:04:12 14:38:32
Time Scale : 60000
Duration : 0:17:42
Preferred Rate : 1
Preferred Volume : 100.00%
Preview Time : 0 s
Preview Duration : 0 s
Poster Time : 0 s
Selection Time : 0 s
Selection Duration : 0 s
Current Time : 0 s
Next Track ID : 6
Firmware Version : HD5.03.02.51.00
Lens Serial Number : NAH6092300301117
Camera Serial Number Hash : 34676f2cdf49b86a1514817a93377bf7
Track Header Version : 0
Track Create Date : 2018:04:12 14:38:32
Track Modify Date : 2018:04:12 14:38:32
Track ID : 1
Track Duration : 0:17:42
Track Layer : 0
Track Volume : 0.00%
Image Width : 1920
Image Height : 1080
Graphics Mode : srcCopy
Op Color : 0 0 0
Compressor ID : avc1
Source Image Width : 1920
Source Image Height : 1080
X Resolution : 72
Y Resolution : 72
Compressor Name : GoPro AVC encoder
Bit Depth : 24
Color Representation : nclx 1 1 1
Video Frame Rate : 59.94
Time Code : 3
Balance : 0
Audio Format : mp4a
Audio Channels : 2
Audio Bits Per Sample : 16
Audio Sample Rate : 48000
Text Font : Unknown (21)
Text Face : Plain
Text Size : 10
Text Color : 0 0 0
Background Color : 65535 65535 65535
Font Name : Helvetica
Other Format : tmcd
Warning : [minor] The ExtractEmbedded option may find more tags in the movie data
Matrix Structure : 1 0 0 0 1 0 0 0 1
Media Header Version : 0
Media Create Date : 2018:04:12 14:38:32
Media Modify Date : 2018:04:12 14:38:32
Media Time Scale : 60000
Media Duration : 0:17:42
Handler Class : Media Handler
Handler Type : NRT Metadata
Handler Description : GoPro SOS
Gen Media Version : 0
Gen Flags : 0 0 0
Gen Graphics Mode : srcCopy
Gen Op Color : 0 0 0
Gen Balance : 0
Meta Format : fdsc
Image Size : 1920x1080
Megapixels : 2.1
Avg Bitrate : 30.1 Mbps
Rotation : 0Part 2
There is a pretty obvious "stutter" at the 17:42 mark where the two clips are combined. I’ve tried using ffmpeg and iMovie, but both give the same results. The GoPro broke up the event into multiple clips on it’s own so it seems weird that there would be any information missing. Is there any way to get rid of this stutter ?Thanks !
-
FFMPEG "Could not allocate memory" Errors through php
10 décembre 2019, par ApplepieeI’ve tried to find a solution online for days now but cannot find any solution.
I just switched server (Intel Xeon to AMD) and since the switch I’ve not been able to get ffmpeg conversions working through the php script. ffmpeg was the exact same version and all php settings are set.
All commands that the script executes (copied from log files) were tried in shell and executed with no problems.
The errors look like this :
[124] => handler_name : Video Media Handler
[125] => Stream #8:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
[126] => Metadata:
[127] => handler_name : Sound Media Handler
[128] => Stream mapping:
[129] => Stream #0:0 (h264) -> concat:in0:v0
[130] => Stream #1:0 (h264) -> concat:in1:v0
[131] => Stream #2:0 (h264) -> concat:in2:v0
[132] => Stream #3:0 (h264) -> concat:in3:v0
[133] => Stream #4:0 (h264) -> concat:in4:v0
[134] => Stream #5:0 (h264) -> concat:in5:v0
[135] => Stream #6:0 (h264) -> concat:in6:v0
[136] => Stream #7:0 (h264) -> concat:in7:v0
[137] => scale -> Stream #0:0 (libvpx)
[138] => Press [q] to stop, [?] for help
[139] => [h264 @ 0x34f1dc0] get_buffer() failed
[140] => [h264 @ 0x34f1dc0] thread_get_buffer() failed
[141] => [h264 @ 0x34f1dc0] decode_slice_header error
[142] => [h264 @ 0x34f1dc0] no frame!
[143] => [h264 @ 0x350e680] Error splitting the input into NAL units.
[144] => [h264 @ 0x352af40] Cannot allocate memory.
[145] => [h264 @ 0x352af40] Could not allocate memory
[146] => [h264 @ 0x352af40] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
[147] => [h264 @ 0x352af40] Cannot allocate memory.
[148] => [h264 @ 0x352af40] Could not allocate memory
[149] => [h264 @ 0x352af40] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
[150] => [h264 @ 0x352af40] Cannot allocate memory.
[151] => [h264 @ 0x352af40] Could not allocate memory
[152] => [h264 @ 0x352af40] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
[153] => [h264 @ 0x352af40] Cannot allocate memory.
[154] => [h264 @ 0x352af40] Could not allocate memory
[155] => [h264 @ 0x352af40] h264_slice_header_init() failedError while decoding stream #0:0: Cannot allocate memory
[156] => [h264 @ 0x352af40] Cannot allocate memory.
[157] => [h264 @ 0x352af40] Could not allocate memory
...
..
[211519] => [h264 @ 0x886a3c0] h264_slice_header_init() failedToo many errors when draining, this is a bug. Stop draining and force EOF.
[211520] => Error while decoding stream #7:0: Internal bug, should not have happened
[211521] => Cannot allocate memory.
[211522] => sws: initFilter failed
[211523] => [Parsed_scale_1 @ 0x8e0be40] Failed to configure output pad on Parsed_scale_1
[211524] => Error reinitializing filters!
[211525] => Error while filtering: Operation not permitted
[211526] => Finishing stream 0:0 without any data written to it.
[211527] => [libvpx @ 0x6f4c600] v1.8.1-301-g89375f031
[211528] => Output #0, webm, to '/home/website/public_html/media/videos/tmb/2420/video_copy.webm':
[211529] => Metadata:
[211530] => major_brand : isom
[211531] => minor_version : 512
[211532] => compatible_brands: isomiso2avc1mp41
[211533] => title : Aibeya The Animation
[211534] => encoder : Lavf58.35.100
[211535] => Chapter #0:0: start 0.000000, end 102.102000
[211536] => Metadata:
[211537] => title : Intro
[211538] => Chapter #0:1: start 102.102000, end 110.369000
[211539] => Metadata:
[211540] => title : Title
[211541] => Chapter #0:2: start 110.369000, end 312.179000
[211542] => Metadata:
[211543] => title : Part 1
[211544] => Chapter #0:3: start 312.179000, end 548.415000
[211545] => Metadata:
[211546] => title : Part 2
[211547] => Chapter #0:4: start 548.415000, end 706.831000
[211548] => Metadata:
[211549] => title : Part 3
[211550] => Chapter #0:5: start 706.831000, end 1011.052000
[211551] => Metadata:
[211552] => title : Part 4
[211553] => Chapter #0:6: start 1011.052000, end 1198.823000
[211554] => Metadata:
[211555] => title : Part 5
[211556] => Chapter #0:7: start 1198.823000, end 1501.408000
[211557] => Metadata:
[211558] => title : Part 6
[211559] => Chapter #0:8: start 1501.408000, end 1579.945000
[211560] => Metadata:
[211561] => title : Part 7
[211562] => Chapter #0:9: start 1579.945000, end 1654.293000
[211563] => Metadata:
[211564] => title : Ending
[211565] => Stream #0:0: Video: vp8 (libvpx), yuv420p, 400x240 [SAR 837:785 DAR 279:157], q=10-42, 250 kb/s, 23.98 fps, 1k tbn, 23.98 tbc (default)
[211566] => Metadata:
[211567] => encoder : Lavc58.64.101 libvpx
[211568] => Side data:
[211569] => cpb: bitrate max/min/avg: 0/0/0 buffer size: 600000 vbv_delay: N/A
[211570] => frame= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A speed= 0x
[211571] => video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[211572] => Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
[211573] => Conversion failed!
)Command example used :
ffmpeg_command is /usr/local/bin/ffmpeg -ss 100 -t 1 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 197 -t 2 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 294 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 391 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 488 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 585 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 682 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 779 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -ss 876 -t 3 -i /home/website/public_html/media/videos/iphone/2407.mp4 -filter_complex "[0][1][2][3][4][5][6][7]concat=n=8:v=1:a=0",scale=400:240 -codec:v libx264 -unsharp -b:v 250k -maxrate 250k -bufsize 600k -qmin 10 -qmax 42 -threads 4 -an -y /home/website/public_html/media/videos/tmb/2407/video_copy.mp4
PHP Info :
PHP 5.6
memory_limit 2001M
max_execution_time 7200
upload_max_filesize 2000M
post_max_size 2000M
max_input_time 7200
exec is not disabledServer info
CentOS Linux 7 (Core)
ADVANCE-4 - AMD Epyc 7351P - 128GB DDR4 ECC 2400MHz - 2x HDD SATA 4TB Datacenter Class + 2x SSD NVMe 500GB Enterprise Class Soft RAIDAll help is really appreciated ! Thanks in advance