
Recherche avancée
Médias (16)
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (86)
-
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela. -
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)
Sur d’autres sites (6344)
-
Inconsistent behaviour of ffmpeg -i flag
19 mai 2021, par zeebrahI'm trying to write a Bash script that would download an audio track from youtube and convert it to Apple ringtone format, which is .m4r. The tools I employ are
youtube-dl
andffmpeg
. The former seems to work fine but I have a strange issue with the latter. When I try to pass the name of the file parametrically, shell prints that file or directory can't be found.

I use the same method for unwraping user input (or my defaults) for both commands but it only seems to work with
youtube-dl
.

Example of what doesn't work and print the text above. Obviously, all the files are in fact there and accessible


youtube-dl -i --extract-audio --audio-format m4a -o $filepath_interim --audio-quality 0 $video_link
ffmpeg -i $filepath_interim -acodec copy -f ipod -ss $offset -t $length $filepath_out



So, I tried to do it with
''
strings,$(command)
syntax, it all failed. I only found one way to make it work, which is to hard code the values of the paths but this defeats the whole purpose of my script.

youtube-dl -i --extract-audio --audio-format m4a -o $filepath_interim --audio-quality 0 $video_link
ffmpeg -i ~/Downloads/ringtone.m4a -acodec copy -f ipod -ss $offset -t $length ~/Downloads/ringtone.m4r



I want to figure out why this keeps happening, whether it is in any way specific to
ffmpeg
or am I just missing some piece of knowledge about$
name unwrapping.

Minimal Working Example. Run with bash or pack in script and run. If your path to
bash
is different, please change the shebang :

#!/usr/local/bin/bash
# initialise
filepath_interim="~/Downloads/ringtone.m4a"
filepath_out="~/Downloads/ringtone.m4r"
video_link="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
offset=0
length=30

# main part
youtube-dl -i --extract-audio --audio-format m4a -o $filepath_interim --audio-quality 0 $video_link
ffmpeg -i $filepath_interim -acodec copy -f ipod -ss $offset -t $length $filepath_out



-
How to minimize latency in ffmpeg stream Java ?
13 juillet 2022, par Taavi SõerdI need to stream ffmpeg video feed in android studio and need minimal latency. Code below has achieved that when playing on galaxy s21 ultra but when I play it on galaxy tab then it's like in slow motion. When i set buffer size to 0 I get minimal latency but can't actually even see the video as it's all corrupted (all gray and colored noise).


public class Decode implements Runnable {
public Activity activity;
AVFrame pFrameRGB;
SwsContext sws_ctx;
ByteBuffer bitmapBuffer;
Bitmap bmp;
byte[] array;
int imageViewWidth = 0;
int imageViewHeight = 0;
boolean imageChanged = true;
int v_stream_idx = -1;
int klv_stream_idx = -1;

boolean imageDrawMutex = false;

boolean imageIsSet = false;
ImageView imageView = MainActivity.getmInstanceActivity().findViewById(R.id.imageView);

String mFilename = "udp://@" + MainActivity.connectionIP;;
UasDatalinkLocalSet mLatestDls;

public Decode(Activity _activity) {
 this.activity = _activity;
}

public void create_decoder(AVCodecContext codec_ctx) {
 imageChanged = true;

 // Determine required buffer size and allocate buffer
 int numBytes =av_image_get_buffer_size(AV_PIX_FMT_RGBA, codec_ctx.width(),
 codec_ctx.height(), 1);
 BytePointer buffer = new BytePointer(av_malloc(numBytes));

 bmp = Bitmap.createBitmap(codec_ctx.width(), codec_ctx.height(), Bitmap.Config.ARGB_8888);

 array = new byte[codec_ctx.width() * codec_ctx.height() * 4];
 bitmapBuffer = ByteBuffer.wrap(array);

 sws_ctx = sws_getContext(
 codec_ctx.width(),
 codec_ctx.height(),
 codec_ctx.pix_fmt(),
 codec_ctx.width(),
 codec_ctx.height(),
 AV_PIX_FMT_RGBA,
 SWS_POINT,
 null,
 null,
 (DoublePointer) null
 );

 if (sws_ctx == null) {
 Log.d("app", "Can not use sws");
 throw new IllegalStateException();
 }

 av_image_fill_arrays(pFrameRGB.data(), pFrameRGB.linesize(),
 buffer, AV_PIX_FMT_RGBA, codec_ctx.width(), codec_ctx.height(), 1);
}

@Override
public void run() {
 Log.d("app", "Start decoder");

 int ret = -1, i = 0;
 String vf_path = mFilename;

 AVFormatContext fmt_ctx = new AVFormatContext(null);
 AVPacket pkt = new AVPacket();


 AVDictionary multicastDict = new AVDictionary();

 av_dict_set(multicastDict, "rtsp_transport", "udp_multicast", 0);

 av_dict_set(multicastDict, "localaddr", getIPAddress(true), 0);
 av_dict_set(multicastDict, "reuse", "1", 0);

 av_dict_set(multicastDict, "buffer_size", "0.115M", 0);

 ret = avformat_open_input(fmt_ctx, vf_path, null, multicastDict);
 if (ret < 0) {
 Log.d("app", String.format("Open video file %s failed \n", vf_path));
 byte[] error_message = new byte[1024];
 int elen = av_strerror(ret, error_message, 1024);
 String s = new String(error_message, 0, 20);
 Log.d("app", String.format("Return: %d", ret));
 Log.d("app", String.format("Message: %s", s));
 throw new IllegalStateException();
 }
 
 if (avformat_find_stream_info(fmt_ctx, (PointerPointer) null) < 0) {
 //System.exit(-1);
 Log.d("app", "Stream info not found");
 }


 avformat.av_dump_format(fmt_ctx, 0, mFilename, 0);

 int nstreams = fmt_ctx.nb_streams();

 for (i = 0; i < fmt_ctx.nb_streams(); i++) {
 if (fmt_ctx.streams(i).codecpar().codec_type() == AVMEDIA_TYPE_VIDEO) {
 v_stream_idx = i;
 }
 if (fmt_ctx.streams(i).codecpar().codec_type() == AVMEDIA_TYPE_DATA) {
 klv_stream_idx = i;
 }
 }
 if (v_stream_idx == -1) {
 Log.d("app", "Cannot find video stream");
 throw new IllegalStateException();
 } else {
 Log.d("app", String.format("Video stream %d with resolution %dx%d\n", v_stream_idx,
 fmt_ctx.streams(v_stream_idx).codecpar().width(),
 fmt_ctx.streams(v_stream_idx).codecpar().height()));
 }

 AVCodecContext codec_ctx = avcodec_alloc_context3(null);
 avcodec_parameters_to_context(codec_ctx, fmt_ctx.streams(v_stream_idx).codecpar());


 AVCodec codec = avcodec_find_decoder(codec_ctx.codec_id());


 AVDictionary avDictionary = new AVDictionary();

 av_dict_set(avDictionary, "fflags", "nobuffer", 0);


 if (codec == null) {
 Log.d("app", "Unsupported codec for video file");
 throw new IllegalStateException();
 }
 ret = avcodec_open2(codec_ctx, codec, avDictionary);
 if (ret < 0) {
 Log.d("app", "Can not open codec");
 throw new IllegalStateException();
 }

 AVFrame frm = av_frame_alloc();

 // Allocate an AVFrame structure
 pFrameRGB = av_frame_alloc();
 if (pFrameRGB == null) {
 //System.exit(-1);
 Log.d("app", "unable to init pframergb");
 }

 create_decoder(codec_ctx);

 int width = codec_ctx.width();
 int height = codec_ctx.height();

 double fps = 15;
 

 while (true) {
 try {
 Thread.sleep(1);
 } catch (Exception e) {

 }

 try {
 if (av_read_frame(fmt_ctx, pkt) >= 0) {
 if (pkt.stream_index() == v_stream_idx) {
 avcodec_send_packet(codec_ctx, pkt);

 if (codec_ctx.width() != width || codec_ctx.height() != height) {
 create_decoder(codec_ctx);
 width = codec_ctx.width();
 height = codec_ctx.height();
 }
 }

 if (pkt.stream_index() == klv_stream_idx) {

 byte[] klvDataBuffer = new byte[pkt.size()];

 for (int j = 0; j < pkt.size(); j++) {
 klvDataBuffer[j] = pkt.data().get(j);
 }

 try {
 KLV k = new KLV(klvDataBuffer, KLV.KeyLength.SixteenBytes, KLV.LengthEncoding.BER);
 byte[] main_payload = k.getValue();

 // decode the Uas Datalink Local Set from main_payload binary blob.
 mLatestDls = new UasDatalinkLocalSet(main_payload);

 if (mLatestDls != null) {

 MainActivity.getmInstanceActivity().runOnUiThread(new Runnable() {
 @RequiresApi(api = Build.VERSION_CODES.Q)
 @Override
 public void run() {
 MainActivity.getmInstanceActivity().updateKlv(mLatestDls);
 }
 });
 }
 } catch (Exception e) {
 e.printStackTrace();
 }
 
 }

 int wasFrameDecoded = 0;
 while (wasFrameDecoded >= 0) {
 wasFrameDecoded = avcodec_receive_frame(codec_ctx, frm);

 if (wasFrameDecoded >= 0) {
 // get clip fps
 fps = 15; //av_q2d(fmt_ctx.streams(v_stream_idx).r_frame_rate());

 sws_scale(
 sws_ctx,
 frm.data(),
 frm.linesize(),
 0,
 codec_ctx.height(),
 pFrameRGB.data(),
 pFrameRGB.linesize()
 );

 if(!imageDrawMutex) {
 MainActivity.getmInstanceActivity().runOnUiThread(new Runnable() {
 @Override
 public void run() {
 if (imageIsSet) {
 imageDrawMutex = true;
 pFrameRGB.data(0).position(0).get(array);
 bitmapBuffer.rewind();
 bmp.copyPixelsFromBuffer(bitmapBuffer);

 if (imageChanged) {
 (imageView).setImageBitmap(bmp);
 imageChanged = false;
 }

 (imageView).invalidate();
 imageDrawMutex = false;
 } else {
 (imageView).setImageBitmap(bmp);
 imageIsSet = true;
 }
 }
 });
 }
 }
 }
 av_packet_unref(pkt);

 }
 } catch (Exception e) {
 e.printStackTrace();
 }

 if (false) {
 Log.d("threads", "false");

 av_frame_free(frm);

 avcodec_close(codec_ctx);
 avcodec_free_context(codec_ctx);

 avformat_close_input(fmt_ctx);
 }
 }
}



This code is running in Android Studio with Java. I'm quite new on this topic so not really sure even where to start.
What could be the cause of that ?


-
avformat/mpegts : parse sections with multiple tables
9 mai 2018, par Aman Guptaavformat/mpegts : parse sections with multiple tables
Fixes PMT parsing in some mpegts streams which contain
multiple tables within the PMT pid. Previously, the parser
assumed only one table was present in each packet, and discarded
the rest of the section data after attempting to parse the first
table.A similar issue was documented in the BeyondTV software[1], which
helped me diagnose the same bug in the ffmpeg mpegts demuxer. I also
tried DVBInspector, libdvbpsi's dvbinfo, and tstools' tsinfo to
help debug. The former two properly read PMTs with multiple tables,
whereas the last has the same bug as ffmpeg.I've created a minimal sample[2] which contains the combined PMT.
Here's what ffmpeg probe shows before and after this patch :Before :
Input #0, mpegts, from 'combined-pmt-tids.ts' :
Duration : 00:00:01.08, start : 4932.966167, bitrate : 741 kb/s
Program 1
No Program
Stream #0:0[0xf9d] : Audio : ac3, 48000 Hz, mono, fltp, 96 kb/s
Stream #0:1[0xf9b] : Audio : mp3, 0 channels, fltp
Stream #0:2[0xf9c] : Unknown : noneAfter :
Input #0, mpegts, from 'combined-pmt-tids.ts' :
Duration : 00:00:01.11, start : 4932.966167, bitrate : 718 kb/s
Program 1
Stream #0:0[0xf9b] : Video : mpeg2video ([2][0][0][0] / 0x0002), none(tv, top first), 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
Stream #0:1[0xf9c](eng) : Audio : ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
Stream #0:2[0xf9d](spa) : Audio : ac3 (AC-3 / 0x332D4341), 48000 Hz, mono, fltp, 96 kb/sWith the patch, the PMT is parsed correctly so the streams are
created in the correct order, are associated with "Program 1",
and their codecs are set correctly.[1] http://forums.snapstream.com/vb/showpost.php?p=343816&postcount=201
[2] https://s3.amazonaws.com/tmm1/combined-pmt-tids.tsSigned-off-by : Aman Gupta <aman@tmm1.net>
Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>