
Recherche avancée
Médias (3)
-
Valkaama DVD Cover Outside
4 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Valkaama DVD Cover Inside
4 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
Autres articles (77)
-
MediaSPIP Core : La Configuration
9 novembre 2010, parMediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...) -
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" ; -
Installation en mode ferme
4 février 2011, parLe mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
C’est la méthode que nous utilisons sur cette même plateforme.
L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)
Sur d’autres sites (5333)
-
passing script variable of filename with spaces in bash to external program (ffmpeg) fails
13 janvier 2016, par BostonScottShort story : I’m trying to write a script that will use FFmpeg to convert the many files stored in one directory to a "standard" mp4 format and save the converted files in another directory. It’s been a learning experience (a fun one !) since I haven’t done any real coding since using Pascal and FORTRAN on an IBM 370 mainframe was in vogue.
Essentially the script takes the filename, strips the path and extension off it, reassembles the filename with the path and an mp4 extension and calls FFmpeg with some set parameters to do the conversion. If the directory contains only video files with without spaces in the names, then everything works fine. If the filenames contain spaces, then FFmpeg is not able to process the file and moves on to the next one. The error indicates that FFMpeg is only seeing the filename up to the first space. I’ve included both the script and output below.
Thanks for any help and suggestions you may have. If you think I should be doing this in another way, please by all means, give me your suggestions. As I said, it’s been a long time since I did anything like this. I’m enjoying it though.
I’ve include the code first followed by example output.
for file in ./TBC/*.mp4
do
echo "Start of iteration"
echo "Full text of file name:" $file
#Remove everything up to "C/" (filename without path)
fn_orig=${file#*C/}
echo "Original file name:" $fn_orig
#Length of file name
fn_len=${#fn_orig}
echo "Filename Length:" $fn_len
#file name without path or extension
fn_base=${fn_orig:0:$fn_len-4}
echo "Base file name:" $fn_base
#new filename suffix
newsuffix=".conv.mp4"
fn_out=./CONV/$fn_base$newsuffix
echo "Converted file name:" $fn_out
ffmpeg -i $file -metadata title="$fn_orig" -c:v libx264 -c:a libfdk_aac -b:a 128k $fn_out
echo "End of iteration"
echo
done
echo "Script completed"With the ffmpeg line commented out, and two files in the ./TBC directory, this is the output that I get
Start of iteration
Full text of file name: ./TBC/Test file with spaces.mp4
Original filename: Test file with spaces.mp4
Filename Length: 25
Base filename: Test file with spaces
Converted file name: ./CONV/Test file with spaces.conv.mp4
End of iteration
Start of iteration
Full text of file name: ./TBC/Test_file_with_NO_spaces.mp4
Original file name: Test_file_with_NO_spaces.mp4
Filename Length: 28
Base file name: Test_file_with_NO_spaces
Converted file name: ./CONV/Test_file_with_NO_spaces.conv.mp4
End of iteration
Script completedI won’t bother to post the results when ffmpeg is uncommented, other than to state that it fails with the error :
./TBC/Test : No such file or directoryThe script then continues to the next file which completes successfully because it has no spaces in its name. The actual filename is "Test file with spaces.mp4" so you can see that ffmpeg stops after the word "Test" when it encounters a space.
I hope this has been clear and concise and hopefully someone will be able to point me in the right direction. There is a lot more that I want to do with this script such as parsing subdirectories and ignoring non-video files, etc.
I look forward to any insight you can give !
-
Saving frames as images using FFmpeg
25 octobre 2014, par Mr AlmightyThere are some tutorials on the internet about it, most of them is using deprecated functions and unfortunately the API use to broke and it makes a mess and I’m really confused.
I’m following tutorials, learning with the documentation and seeing the examples of the current version (even that way some examples does not work).
What I’m trying to do is to save frames in
.png
, following the examples and reading I did this, but I’m confused about the conversion the frame to RBG and saving it :#include <iostream>
extern "C"
{
#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libavutil></libavutil>avutil.h>
}
int main(int argc, char ** argv)
{
if (argc < 2)
{
av_log(0, AV_LOG_FATAL, "Usage: %s <input />", argv[0]);
return -1;
}
const char * filename = argv[1];
// register all codecs and formats
av_register_all();
// open input file, and allocate format context
AVFormatContext *avFormatContext = avformat_alloc_context();
if (avformat_open_input(&avFormatContext, filename, 0, 0) < 0)
{
av_log(0, AV_LOG_FATAL, "Could not open source file %s", filename);
return -1;
}
// retrieve stream information
if (avformat_find_stream_info(avFormatContext, 0) < 0)
{
av_log(0, AV_LOG_FATAL, "Could not find stream information");
return -1;
}
// dump information about file onto standard error
av_dump_format(avFormatContext, 0, filename, 0);
// find the "best" video stream in the file.
int result = av_find_best_stream(avFormatContext, AVMEDIA_TYPE_VIDEO, -1, -1, 0, 0);
if (result < 0)
{
av_log(0, AV_LOG_FATAL, "Could not find %s stream in input file '%s'", av_get_media_type_string(AVMEDIA_TYPE_VIDEO), filename);
return -1;
}
int stream = result;
AVStream *avStream = avFormatContext->streams[stream];
AVCodecContext *avCodecContext = avStream->codec;
// find decoder for the stream
AVCodec *avCodec = avcodec_find_decoder(avCodecContext->codec_id);
if (! avCodec)
{
av_log(0, AV_LOG_FATAL, "Failed to find %s codec", av_get_media_type_string(AVMEDIA_TYPE_VIDEO));
return -1;
}
// init the decoders, with reference counting
AVDictionary *avDictionary = 0;
av_dict_set(&avDictionary, "refcounted_frames", "1", 0);
if (result = avcodec_open2(avCodecContext, avCodec, &avDictionary) < 0)
{
av_log(0, AV_LOG_FATAL, "Failed to open %s codec", av_get_media_type_string(AVMEDIA_TYPE_VIDEO));
return -1;
}
AVFrame *avFrame = av_frame_alloc();
if (! avFrame)
{
av_log(0, AV_LOG_FATAL, "Could not allocate frame");
return -1;
}
// initialize packet, set data to null, let the demuxer fill it
AVPacket avPacket;
av_init_packet(&avPacket);
avPacket.data = 0;
avPacket.size = 0;
while (av_read_frame(avFormatContext, &avPacket) >= 0)
{
if (avPacket.stream_index == stream)
{
int success = avcodec_decode_video2(avCodecContext, avFrame, &success, &avPacket);
if (success <= 0)
{
av_log(0, AV_LOG_FATAL, "Error decoding video frame");
return -1;
}
// ... saving...
}
}
avcodec_close(avCodecContext);
avformat_close_input(&avFormatContext);
av_frame_free(&avFrame);
return 0;
}
</iostream> -
Next pts does not match previous pts plus duration when transcoding an AAC audio with ffmpeg
17 septembre 2021, par b1subIn my understanding, the following statement must hold :


next pts = previous pts + duration



But, I got this list of
PTS
es fromffprobe
that looks odd to me :

<packet pts="63000" duration="2089">
<packet pts="65070" duration="2089">
<packet pts="67140" duration="2089">
<packet pts="69300" duration="2089">
<packet pts="71370" duration="2089">
<packet pts="73440" duration="2089">
<packet pts="75510" duration="2089">
<packet pts="77670" duration="2089">
</packet></packet></packet></packet></packet></packet></packet></packet>


The corresponding
PTS
gaps are as follows. You can see none of the below gaps matches2089
:

63000 <> 65070: 2070
65070 <> 67140: 2070
67140 <> 69300: 2160
69300 <> 71370: 2070
71370 <> 73440: 2070
73440 <> 75510: 2070
75510 <> 77670: 2160



I have no deep understanding of
AAC
or transcoding, so I talked with some random guy on#ffmpeg
. As per what he said, the gap should be a fixed value :

20:01 -!- Icedream [~icedream@hzn-b.serverkomplex.de] has quit [Quit: A lol made me boom.]
20:02 < DeHackEd> I would expect them to increment at a constant rate, since AAC (which is probably what you're using) uses fixed size
 audio chunks. But that's very inconsistent
20:03 < DeHackEd> (+/- 1 pts number would be acceptable)



To tell you the truth, this is a problematic video, but not in a way you would expect. I'm getting intermittent audio clipping sound, if two or more audio packets are crammed into a single
PES
packet. What's special about this configuration is that, the player must guessPTS
es for the trailing audio packets except the first one. Since thePTS
gaps are not consistent, the player must have used wrongPTS
es for the trailing ones, and this looks to me like the cause.

But, what could be the trigger ? Here are some contexts you can kindly refer to :


- 

- the original video has no surprising
PTS
gap. This is the result from my custom-made script to extract all unique gaps :




$ ./foo.sh ./original.flv
diff 296448 occurs at 296448 // just a first packet (=has no previous packet)
diff 24 occurs at 296472
diff 23 occurs at 296495



- 

- this is the command I used for transcoding :




$FFMPEG -hide_banner -loglevel info -nostats \
 -i $input \
 -map "[out1]" -c:v libx264 -r 30 -force_key_frames "expr:gte(t, n_forced*$keyFrameInterval)" -preset veryfast -vprofile high -minrate 4.5M -maxrate 6M -bufsize 6M \
 -map 0:a -c:a aac -b:a:1 128K -af "aformat=sample_rates=44100|48000:channel_layouts=stereo" \
 -map 0:a -c:a aac -b:a:2 32K -af "aformat=sample_rates=44100|48000:channel_layouts=stereo" \
 -f mpegts -tune zerolatency pipe:1 > \
 >($FFMPEG -hide_banner -loglevel info -nostats \
 -i - \
 -map 0:v -c:v copy -map 0:1 -c:a copy -bsf:a aac_adtstoasc -tune zerolatency -f flv -max_muxing_queue_size 1024 ${output}_1080 \
 -map 0:v -s $(width 1280 720 $orientation)x$(height 1280 720 $orientation) -c:v libx264 -r 30 -force_key_frames "expr:gte(t, n_forced*$keyFrameInterval)" -preset veryfast -vprofile high -minrate 3M -maxrate 4M -bufsize 4M -map 0:1 -c:a copy -bsf:a aac_adtstoasc -f flv -tune zerolatency -max_muxing_queue_size 1024 ${output}_720 \
 ...



- the original video has no surprising