
Recherche avancée
Autres articles (36)
-
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 (...) -
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. -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (5737)
-
Reduce ffmpeg CPU usage with h265 [closed]
23 septembre 2024, par NeskelogthI have a video file to convert using
ffmpeg
on Ubuntu 22.04. The input uses the codech264
and I want to convert it toh265
(mainly for storage capacity reasons). The output offfmpeg -version
is

ffmpeg version N-113725-g37702e2066 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --disable-static --enable-shared --enable-libx265 --enable-gpl
libavutil 58. 39.100 / 58. 39.100
libavcodec 60. 39.101 / 60. 39.101
libavformat 60. 21.101 / 60. 21.101
libavdevice 60. 4.100 / 60. 4.100
libavfilter 9. 17.100 / 9. 17.100
libswscale 7. 6.100 / 7. 6.100
libswresample 4. 13.100 / 4. 13.100
libpostproc 57. 4.100 / 57. 4.100



I saw online that one of the options of
ffmpeg
is-threads
, but apparently it does not work, since usingffmpeg -i input.mp4 -c:v libx265 -c:a copy output.mp4
andffmpeg -i input.mp4 -c:v libx265 -c:a copy -threads 2 output.mp4
seem to be exactly the same in terms of CPU usage as shown byhtop
. Is there something wrong in my usage of-threads
?

-
I am converting images to video using ffmpeg in koltin but i am getting error
28 mars 2024, par Mohith_karthikeyai implement ffmpeg by using this gitbub by this reference :5

https://github.com/tanersener/mobile-ffmpeg
in koltin
my code is :

class BurstModeToVideo(
 private val context: Context,
 private val onVideoConverted: (File) -> Unit
) {

 private val vibeDirectory = File(context.getExternalFilesDir(Environment.DIRECTORY_PICTURES), "vibes")
 private val outputDirectory = context.getExternalFilesDir(Environment.DIRECTORY_MOVIES)

 fun convertBitmapToJpeg(vibes: List<bitmap>) {
 if (!vibeDirectory.exists()) {
 vibeDirectory.mkdirs()
 }

 vibes.forEachIndexed { index, vibe ->
 val fileName = "$index.jpg"
 val file = File(vibeDirectory, fileName)
 FileOutputStream(file).use { fos ->
 vibe.compress(Bitmap.CompressFormat.JPEG, 100, fos)
 }
 }
 }

 private val callback = ExecuteCallback { _, returnCode ->
 if (returnCode == Config.RETURN_CODE_SUCCESS) {
 try {
 val tempFile = File("${outputDirectory?.absolutePath}/vibe.mp4")
 onVideoConverted(tempFile)
 Log.e(TAG, "FFmpeg output found $tempFile")
 Toast.makeText(context,"$tempFile",Toast.LENGTH_LONG).show()
 Log.e(TAG, "FFmpeg output found $")
 } catch (e: IOException) {
 Log.e(TAG, "Error handling FFmpeg output", e)
 }
 } else {
 Log.i(TAG, "Async command execution failed with returnCode=$returnCode.")
 }
 }

 fun convertShotsToVideo() {
 if (!vibeDirectory.exists() || vibeDirectory.listFiles()?.isEmpty() == true) {
 Log.e(TAG, "No images to convert")
 return
 }

 Log.d(TAG, "Images are stored in: ${vibeDirectory.absolutePath}")

 val imageFiles = vibeDirectory.listFiles { file -> file.isFile && file.extension.equals("jpg", ignoreCase = true) }
 if (imageFiles.isNullOrEmpty()) {
 Log.e(TAG, "No image files found in directory")
 return
 }

 Log.d(TAG, "List of image files:")
 imageFiles.forEach { file ->
 Log.d(TAG, file.name)
 }

 val cmd = "-i ${vibeDirectory.absolutePath}/%d.jpg -c:v mpeg4 -y ${outputDirectory?.absolutePath}/vibe.mp4"

 FFmpevubeg.executeAsync(cmd, callback)
 }

 companion object {
 private const val TAG = "BurstModeToVideo"
 }
}
</bitmap>


above function convert images from bimtap to jpeg files and then it converts to video by using ffmpeg. And i initialize this fun in mainactivity.kt and it goes here :


var vibe by remember {
 mutableStateOf(null)
 }

 val burstModeToVideo = BurstModeToVideo(
 context,
 onVideoConverted = {
 vibe = it
 }
 )
coroutineScope.launch {
 withContext(Dispatchers.IO) {
 burstModeToVideo.convertBitmapToJpeg(vibesList)
 burstModeToVideo.convertShotsToVideo()
 }
 }

VideoPlayer(vibe)



now this vibe variable is used in videoPlayer function and it goes here :


@OptIn(UnstableApi::class)
@Composable
fun VideoPlayer(file: File) {
 val context = LocalContext.current

 val exoPlayer = remember {
 ExoPlayer.Builder(context)
 .build()
 .apply {
 val defaultDataSourceFactory = DefaultDataSource.Factory(context)
 val dataSourceFactory: DataSource.Factory = DefaultDataSource.Factory(
 context,
 defaultDataSourceFactory
 )
 this.repeatMode = ExoPlayer.REPEAT_MODE_ALL
 this.playWhenReady = true
 val source = file.let {
 ProgressiveMediaSource.Factory(dataSourceFactory)
 .createMediaSource(MediaItem.fromUri(Uri.fromFile(file)))
 }
 this.setMediaSource(source)
 this.prepare()
 this.play()
 this.volume = 0f
 }
 }

 DisposableEffect(Unit) {
 onDispose {
 exoPlayer.release()
 }
 }

 AndroidView(
 factory = { ctx ->
 PlayerView(ctx).apply {
 useController = false
 resizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM
 player = exoPlayer
 }
 },
 modifier = Modifier.fillMaxSize()
 )
}



the error is :


MediaCodec will operate in async mode
2024-03-28 20:08:53.065 18946-27920 OplusCCodec com.example.flenzey D initiateShutdown [475]: (0xb400007656569fc0) keepComponentAllocated=0
2024-03-28 20:08:53.067 18946-27920 BpBinder com.example.flenzey I onLastStrongRef automatically unlinking death recipients: android.media.IResourceManagerService
2024-03-28 20:08:53.069 18946-27926 hw-BpHwBinder com.example.flenzey I onLastStrongRef automatically unlinking death recipients
2024-03-28 20:08:53.071 18946-27926 OplusCCodec com.example.flenzey D ~OplusCCodec [144]: (0xb400007656569fc0)
2024-03-28 20:08:53.077 18946-27889 MediaCodecRenderer com.example.flenzey W Failed to initialize decoder: c2.android.mpeg4.decoder
 java.lang.IllegalArgumentException
 at android.media.MediaCodec.native_configure(Native Method)
 at android.media.MediaCodec.configure(MediaCodec.java:2176)
 at android.media.MediaCodec.configure(MediaCodec.java:2092)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.initialize(AsynchronousMediaCodecAdapter.java:174)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.access$100(AsynchronousMediaCodecAdapter.java:54)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter$Factory.createAdapter(AsynchronousMediaCodecAdapter.java:119)
 at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:117)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1195)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1103)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:551)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1560)
 at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:1152)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:994)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:814)
 at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:940)
 at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1102)
 at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:541)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loopOnce(Looper.java:238)
 at android.os.Looper.loop(Looper.java:349)
 at android.os.HandlerThread.run(HandlerThread.java:67)
2024-03-28 20:08:53.091 18946-27889 MediaCodecVideoRenderer com.example.flenzey E Video codec error
 androidx.media3.exoplayer.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: c2.android.mpeg4.decoder, Format(1, null, null, video/mp4v-es, null, 22800180, null, [2448, 3264, 24.999998, ColorInfo(Unset color space, Unset color range, Unset color transfer, false, 8bit Luma, 8bit Chroma)], [-1, -1])
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1114)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:551)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1560)
 at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:1152)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:994)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:814)
 at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:940)
 at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1102)
 at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:541)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loopOnce(Looper.java:238)
 at android.os.Looper.loop(Looper.java:349)
 at android.os.HandlerThread.run(HandlerThread.java:67)
 Caused by: java.lang.IllegalArgumentException
 at android.media.MediaCodec.native_configure(Native Method)
 at android.media.MediaCodec.configure(MediaCodec.java:2176)
 at android.media.MediaCodec.configure(MediaCodec.java:2092)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.initialize(AsynchronousMediaCodecAdapter.java:174)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.access$100(AsynchronousMediaCodecAdapter.java:54)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter$Factory.createAdapter(AsynchronousMediaCodecAdapter.java:119)
 at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:117)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1195)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1103)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:551) 
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1560) 
 at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:1152) 
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:994) 
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:814) 
 at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:940) 
 at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1102) 
 at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:541) 
 at android.os.Handler.dispatchMessage(Handler.java:102) 
 at android.os.Looper.loopOnce(Looper.java:238) 
 at android.os.Looper.loop(Looper.java:349) 
 at android.os.HandlerThread.run(HandlerThread.java:67) 
2024-03-28 20:08:53.092 18946-27889 MediaCodecInfo com.example.flenzey D NoSupport [sizeAndRate.support, 2448x3264@24.999998092651367] [c2.android.mpeg4.decoder, video/mp4v-es] [OP535DL1, CPH2381, OnePlus, 31]
2024-03-28 20:08:53.108 18946-27889 ExoPlayerImplInternal com.example.flenzey E Playback error
 androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/mp4v-es, null, 22800180, null, [2448, 3264, 24.999998, ColorInfo(Unset color space, Unset color range, Unset color transfer, false, 8bit Luma, 8bit Chroma)], [-1, -1]), format_supported=NO_EXCEEDS_CAPABILITIES
 at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:620)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loopOnce(Looper.java:238)
 at android.os.Looper.loop(Looper.java:349)
 at android.os.HandlerThread.run(HandlerThread.java:67)
 Caused by: androidx.media3.exoplayer.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: c2.android.mpeg4.decoder, Format(1, null, null, video/mp4v-es, null, 22800180, null, [2448, 3264, 24.999998, ColorInfo(Unset color space, Unset color range, Unset color transfer, false, 8bit Luma, 8bit Chroma)], [-1, -1])
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1114)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:551)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1560)
 at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:1152)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:994)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:814)
 at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:940)
 at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1102)
 at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:541)
 at android.os.Handler.dispatchMessage(Handler.java:102) 
 at android.os.Looper.loopOnce(Looper.java:238) 
 at android.os.Looper.loop(Looper.java:349) 
 at android.os.HandlerThread.run(HandlerThread.java:67) 
 Caused by: java.lang.IllegalArgumentException
 at android.media.MediaCodec.native_configure(Native Method)
 at android.media.MediaCodec.configure(MediaCodec.java:2176)
 at android.media.MediaCodec.configure(MediaCodec.java:2092)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.initialize(AsynchronousMediaCodecAdapter.java:174)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.access$100(AsynchronousMediaCodecAdapter.java:54)
 at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter$Factory.createAdapter(AsynchronousMediaCodecAdapter.java:119)
 at androidx.media3.exoplayer.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:117)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1195)
 at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1103)



can anybody solve it


i tried to implement but i don't how to solve it . please decode this and get me correct result.


-
Converting HLS Stream to stream supported by old radio
29 novembre 2024, par Alberto FaenzaI have an old internet radio that does not support HLS streams.
Therefore I cannot listen to my favourite radio at this url :
https://streamcdnf31-4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/master_ma.m3u8


I found a solution using a paid software https://minimradio.com/ which is based on minimserver and minimstreamer.


This solution works if I install mininmserver and minimstreamer on a local computer and use the internet radio to point to the converter stream but I will have to pay if I want to use this.


Checking the documentation of minimradio and ministreamer I can see the following :


*Some internet radios can play the previous AAC ADTS streams but can't play these new HLS streams
...


If the network stream URL points to an HLS .m3u8 master playlist or media playlist file, MinimStreamer reads this file and uses the HLS protocol to read the stream audio data and send it to the music player as a conventional HTTP stream. This makes the stream playable on music players that don't support the HLS protocol. The audio data in the stream must be encoded in AAC format.*
and not a single destination receiver I should use a streaming (broadcasting) server. What can I use to do that ?


My question is the following :
Is there a way to replicate what minimstreamer is doing using ffmpeg ?
I have tried this :




ffmpeg -re -i https://streamcdnf31-4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/master_ma.m3u8 -c copy -listen 1 -f mpegts http://192.168.1.9:10000




which is playing corrctly in local vlc on the same computer. But when I stop VLC is got this error in ffmpeg :


[https @ 00000291de047400] Cannot reuse HTTP connection for different host: StreamCdnG20-4c4b867c89244861ac216426883d1ad0.msvdn.net:-1 != 4c4b867c89244861ac216426883d1ad0.msvdn.net:-1
[hls @ 00000291dd96d140] keepalive request failed for 'https://4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/play1.m3u8' with error: 'Invalid argument' when parsing playlist
[hls @ 00000291dd96d140] Opening 'https://4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/play1.m3u8' for reading
[hls @ 00000291dd96d140] Skip ('#EXT-X-DISCONTINUITY-SEQUENCE:0')
[hls @ 00000291dd96d140] Skip ('#EXT-X-PROGRAM-DATE-TIME:2024-11-29T06:36:56.926Z')
[hls @ 00000291dd96d140] Skip ('#EXT-X-PROGRAM-DATE-TIME:2024-11-29T06:37:07.314Z')
[hls @ 00000291dd96d140] Skip ('#EXT-X-PROGRAM-DATE-TIME:2024-11-29T06:37:17.571Z')
[https @ 00000291de4e00c0] Opening 'https://StreamCdnG20-4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/20240722T095729_p1s_001086632.ts' for reading
[aost#0:0/copy @ 00000291de1c4f40] Error submitting a packet to the muxer: Error number -10054 occurred
 Last message repeated 1 times
[out#0/mpegts @ 00000291deaa7e40] Error muxing a packet
[out#0/mpegts @ 00000291deaa7e40] Task finished with error code: -10054 (Error number -10054 occurred)
[out#0/mpegts @ 00000291deaa7e40] Terminating thread with return code -10054 (Error number -10054 occurred)
[out#0/mpegts @ 00000291deaa7e40] Error writing trailer: Error number -10054 occurred
[http @ 00000291de8870c0] URL read error: Error number -10054 occurred
[out#0/mpegts @ 00000291deaa7e40] Error closing file: Error number -10054 occurred
[out#0/mpegts @ 00000291deaa7e40] video:0KiB audio:797KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 21.849292%
size= 971KiB time=00:00:50.98 bitrate= 156.0kbits/s speed=1.01x
Conversion failed!



And if I try to connect from my internet radio I immediately got this error :


[aost#0:0/copy @ 0000027081584a40] Error submitting a packet to the muxer: Error number -10053 occurred
 Last message repeated 1 times
[out#0/mpegts @ 0000027081e684c0] Error muxing a packet
[out#0/mpegts @ 0000027081e684c0] Task finished with error code: -10053 (Error number -10053 occurred)
[out#0/mpegts @ 0000027081e684c0] Terminating thread with return code -10053 (Error number -10053 occurred)
[out#0/mpegts @ 0000027081e684c0] Error writing trailer: Error number -10053 occurred
[http @ 0000027081c47680] URL read error: Error number -10053 occurred
[out#0/mpegts @ 0000027081e684c0] Error closing file: Error number -10053 occurred
[out#0/mpegts @ 0000027081e684c0] video:0KiB audio:46KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 13.917515%
size= 52KiB time=00:00:02.94 bitrate= 145.1kbits/s speed= 1.2x
Conversion failed!



What is the correct way to stream this one locally in order to be listened in my internet radio ?
Shall I use ffmpeg or can be done directly with ngnix ? Or shall I use both ?