
Recherche avancée
Autres articles (31)
-
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Use, discuss, criticize
13 avril 2011, parTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users.
Sur d’autres sites (4046)
-
Continously running a PHP script waiting for videos to trancode
12 mai 2017, par IanI’m making a transcoding server which uses FFMPEG to convert videos to flv. After user uploads a video it’s queued for processing in amazon Simple Queue Service. System is linux ubuntu.
Instead of running CRON each 1min I wonder if it would be possible to continously run several PHP scripts (dowload queued files, process downloaded etc). Each of them would have its own queue which would be read every 10s or so looking for new tasks.
My question is :
How to detect if the script is already running ? I’d run CRON each 1min and if one of the programs would not be running I’d load it again. How stuff like that is done on linux ? PID files ?
thanks for help,
ian -
Why does fluent-ffmpeg only work when it throws the error Output stream closed
29 mars 2024, par volume oneI am using fluent-ffmpeg to process a video file (and then upload that to Amazon S3). The code is very straightforward but it only works if :


- 

- pipe option
{end: true}
is set in.output()
- which has a side-effect that causes the following console log output








Processing : 19.261847354642416% done Processing :
32.365144874807335% done Processing : 48.80978326261429% done Processing : 78.35771917058617%
Processing : 91.49377493455148% done Processing :
99.91264359125745% done An error occurred : Output stream closed




Despite that error, it seems the file is generated correctly and it gets uploaded to Amazon S3 fine.


This is the fluent-ffmpeg code :


import {PassThrough} from 'node:stream';
import FFMpeg from 'fluent-ffmpeg';

let PassThroughStream = new PassThrough();

 FFMpeg('/testvideo.mp4')
 .videoCodec('libx264')
 .audioCodec('libmp3lame')
 .size(`640x480`)
 // Stream output requires manually specifying output formats
 .format('mp4')
 .outputOptions('-movflags dash')
 .on('progress', function (progress) {
 console.log('Processing: ' + progress.percent + '% done');
 })
 .on('error', function (err) {
 console.log('An error occurred: ' + err.message);
 })
 .on('end', function () {
 console.log('FFMpeg Processing finished!');
 })
 .output(PassThroughStream, {end: true})
 .run();

 // Now upload to S3
 try {
 await s3Upload({
 AWSS3Client: 'mys3client',
 Bucket: 'publicbucket,
 ACL: "public-read",
 ContentType: 'video/mp4',
 Key: 'whoever/whatever.mp4',
 Body: PassThroughStream
 });
 } catch (error) {
 console.log(`s3Upload error`, error)
 }



If I set the pipe
output()
option to{end: false}
then there is no error from fluent-ffmpeg and I get"Processing: 100% done FFMpeg Processing finished!"
as the final console log.

BUT the problem is that the
s3Upload()
does not do anything. There are no errors. Just no activity.

I feel very uncomfortable letting
fluent-ffmpeg
end in an error even if the code itself does the job intended. It will also cause testing to fail. What could be the issue ?

The command line code is :
ffmpeg -i https:/xxxbucket.s3.amazonaws.com/14555/file-example.mp4 -acodec libmp3lame -vcodec libx264 -filter:v scale=w=trunc(oh*a/2)*2:h=480 -f mp4 -movflags dash pipe:1


- pipe option
-
HLS encoded video (ffmpeg) breaks in Safari when segmented via byte-range
15 juin 2019, par eschieSome of my HLS encoded videos via ffmpeg drop the audio when seeking past the buffer. The only way to sync the audio and video up again is to restart the video. What would be causing this ?
Example Profile :
bitrate: 4800, profile: 'high', level: '4.1', resolution: 1080, framerate: '24000/1001'
ffmpeg
'-y'
'-i' input_file.mov
'-v' error
'-map' '0:0'
'-c:v' libx264
'-x264opts' f'
keyint=23:
min-keyint=23:
no-scenecut
'
'-vf' f'scale=-1:1080'
'-preset' 'slow'
'-profile:v' 'high'
'-level' '4.1'
'-b:v' '4800k'
'-maxrate' '4800k'
'-movflags' 'faststart'
'-bufsize' '9600k'
'-write_tmcd', '0'
'-r' '24000/1001'
output_dirSegmentation CMD :
FFMPEG
'-i' output_dir
'-v' 'error'
'-acodec' 'copy'
'-vcodec' 'copy'
'-hls_time' '4' #seconds
'-hls_list_size' '0'
'-hls_flags' 'single_file'
os.path.join(output_dir, f'{run_id}_{bitrate}.m3u8'Added : apple’s
mediastreamvalidator
outputs a few different errors :Error: Playlist vs segment duration mismatch
--> Detail: Segment duration 98.0146, Playlist duration: 4.7968
--> Source: 1559962503399_2200k.m3u8 - 1559962503399_2200k.ts:1746520@0Error: Measured peak bitrate compared to master playlist declared value exceeds error tolerance
--> Detail: Measured: 3182.61 kb/s, Master playlist: 2173.82 kb/s, Error: 46.41%, Combined rendition name: English
--> Source: ...playlist.m3u8
--> Compare: 1559962503399_2200k.m3u8Error: Different target durations detected
--> Detail: Target duration: 5 vs Target duration: 4
--> Source: 1559962503399_64k.m3u8
--> Compare: 1559962503399_128k.m3u8UPDATE 1 :
I modified the encoding command to utilize tee pseudo-muxer, but it seems the same issue still exists when segmenting HLS as byte-ranges rather than in separate .ts files :$ ffmpeg
-hide_banner
-report
-benchmark
-vstats
-i "../Jane_shallowing_Top_v08.mp4"
-dn
-sn
-filter_complex "[0:v]fps=fps=24.000,setpts=(PTS-STARTPTS),split=[vsplit1][vsplit2];[vsplit1]scale=-1:144[video_144];[vsplit2]scale=-1:1080[video_1080]"
-map "[video_144]"
-r:v:0 "24.000"
-c:v:0 "libx264"
-x264-params "keyint=144:min-keyint=144:scenecut=0:open_gop=0"
-preset:v:0 "slow"
-profile:v:0 "baseline"
-refs:v:0 "2"
-b-pyramid:v:0 "strict"
-tune:v:0 "film"
-b:v:0 "96000"
-maxrate:v:0 "56000"
-bufsize:v:0 "6*56000/8"
-vsync:v:0 "cfr"
-bsf:v:0 "h264_metadata=fixed_frame_rate_flag=1"
-map "[video_1080]"
-r:v:1 "24.000"
-c:v:1 "libx264"
-x264-params "keyint=144:min-keyint=144:scenecut=0:open_gop=0"
-preset:v:1 "slow"
-profile:v:1 "high"
-refs:v:1 "2"
-b-pyramid:v:1 "strict"
-tune:v:1 "film"
-b:v:1 "4800000"
-maxrate:v:1 "4800000"
-bufsize:v:1 "6*4800000/8"
-vsync:v:1 "cfr"
-bsf:v:1 "h264_metadata=fixed_frame_rate_flag=1"
-map a:0 -map a:0
-c:a "libfdk_aac"
-ar "48000"
-ab "128k"
-af "aresample=async=1:min_hard_comp=0.100000:first_pts=0"
-f "hls"
-var_stream_map "v:1,a:0 v:0,a:1"
-hls_time "6.000"
-hls_segment_type "mpegts"
-hls_flags "discont_start+temp_file+single_file"
-hls_list_size "0"
-master_pl_name "playlist.m3u8"
-hls_segment_filename "out_%v.ts" "out_%v.m3u8"Segment duration 98.0267, Playlist duration: 6.0000