
Recherche avancée
Médias (2)
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (62)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)
Sur d’autres sites (6911)
-
M4a (mp4) audio file encoded with pydub+ffmpeg doesn't play on Android
6 juillet 2020, par EvelynI have a python script to split up some
wav
files and export tom4a
using pydub. I'm able to get these files to play on several devices, but not on an Android device (using Google Pixel 3). When I try encoding with straightffmpeg
in terminal, that works fine on the Android device.

What is the difference in these two files, and since
pydub
is usingffmpeg
, what do I need to change to make it do exactly the same as theffmpeg
command ?

Not working


from pydub import AudioSegment
>>> audio = AudioSegment.from_wav("input.wav")
>>> slice = audio[1000:3000]
>>> slice.export("pydub_export.m4a", format="mp4", parameters=["-ac", "1", "-c:a", "libfdk_aac", "-profile:a", "aac_he", "-vbr", "2"])



mediainfo
output :

General
Complete name : pydub_export.m4a
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/mp41)
File size : 11.7 KiB
Duration : 2 s 115 ms
Overall bit rate mode : Constant
Overall bit rate : 45.1 kb/s
Writing application : Lavf58.29.100

Audio
ID : 1
Format : AAC LC SBR
Format/Info : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name : HE-AAC
Format settings : NBC
Codec ID : mp4a-40-5
Duration : 2 s 115 ms
Duration_LastFrame : -22 ms
Bit rate mode : Constant
Bit rate : 41.4 kb/s
Channel(s) : 1 channel
Channel layout : C
Sampling rate : 44.1 kHz
Frame rate : 21.533 FPS (2048 SPF)
Compression mode : Lossy
Stream size : 10.7 KiB (92%)
Default : Yes
Alternate group : 1



Working


$ffmpeg -i input.wav -acodec copy -ss 1 -to 3 input_slice.wav
$ffmpeg -i input_slice.wav -ac 1 -c:a libfdk_aac -profile:a aac_he -vbr 2 ffmpeg_export.m4a



mediainfo
output :

General
Complete name : ffmpeg_export.m4a
Format : MPEG-4
Format profile : Apple audio with iTunes info
Codec ID : M4A (isom/iso2)
File size : 11.2 KiB
Duration : 2 s 112 ms
Overall bit rate mode : Constant
Overall bit rate : 43.6 kb/s
Writing application : Lavf58.29.100

Audio
ID : 1
Format : AAC LC SBR
Format/Info : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name : HE-AAC
Format settings : NBC
Codec ID : mp4a-40-5
Duration : 2 s 112 ms
Duration_LastFrame : -25 ms
Bit rate mode : Constant
Bit rate : 39.9 kb/s
Channel(s) : 1 channel
Channel layout : C
Sampling rate : 44.1 kHz
Frame rate : 21.533 FPS (2048 SPF)
Compression mode : Lossy
Stream size : 10.3 KiB (91%)
Default : Yes
Alternate group : 1



I already tried moving metadata to the front with
-movflags faststart
on the broken file and it didn't make a difference.

-
Remove unnecessary use of avcodec_close().
27 mai 2020, par Anton KhirnovRemove unnecessary use of avcodec_close().
Replace it with avcodec_free_context() or drop it completely as
appropriate. -
Using ffmpeg dll's from a windows 32 bit app
8 avril 2020, par DerekI am trying to use ffmpeg via dll calls from a win32 app (compiled in clarion)



I transcoded the example file encode_video.c and that worked 100% however I was left with a .h264 file instead of a .mp4 file.



I then transcoded the example muxing.c however it crashes and I am at a loss for options.



Any help would be most appreciated.



Encode_mp4 ROUTINE
! avformat_alloc_output_context2 *******************************************************************************************
file_name = 'myvideo.mp4'
! Try guess format from filename
if CHECK_STACK then ds_SaveStack .
Result = avformat_alloc_output_context2(ThisPtrPtr, 0, NullCString, file_name);
if CHECK_STACK then ds_TestStack .
if Result < 0
 ds_OutputDebugString('avformat_alloc_output_context2 Try guess format failed, try mpeg', TRUE)
 CString1 = 'mpeg'
 if CHECK_STACK then ds_SaveStack .
 Result = avformat_alloc_output_context2(ThisPtrPtr, 0, CString1, file_name);
 if CHECK_STACK then ds_TestStack .
 if Result < 0
 ds_OutputDebugString('avformat_alloc_output_context2 failed', TRUE)
 stop('Could not allocate output format context')
 exit
 end
end
formater_ctxt &= (ThisPtrPtr)
!ds_OutputDebugString('formater_ctxt=' & address(formater_ctxt), TRUE)
assert(not(formater_ctxt &= NULL), 'Check AVFormatContext formater_ctxt')
do VerifyFormatContext
assert(formater_ctxt.oformat > 0, 'Check AVFormatContext formater_ctxt.oformat')
formater &= (formater_ctxt.oformat)
do VerifyFormat
ds_OutputDebugString('avformat_alloc_output_context2 OK', TRUE)

! avcodec_find_encoder *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
encoder &= avcodec_find_encoder(formater.video_codec)
if CHECK_STACK then ds_TestStack .
if encoder &= NULL
 ds_OutputDebugString('avcodec_find_encoder failed', TRUE)
 stop('Could not find encoder')
 exit
end
do VerifyEncoder
ds_OutputDebugString('avcodec_find_encoder OK', TRUE)

! avformat_new_stream *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
stream &= avformat_new_stream(formater_ctxt, encoder)
if CHECK_STACK then ds_TestStack .
if stream &= NULL 
 ds_OutputDebugString('avformat_new_stream failed', TRUE)
 stop('Could not create new stream')
 exit
end
do VerifyStream
stream.id = formater_ctxt.nb_streams-1
ds_OutputDebugString('avformat_new_stream OK', TRUE)

! avcodec_alloc_context3 *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
encoder_ctxt &= avcodec_alloc_context3(encoder)
if CHECK_STACK then ds_TestStack .
if encoder_ctxt &= NULL 
 ds_OutputDebugString('avcodec_alloc_context3 failed', TRUE)
 stop('Could not allocate video codec context')
 exit
end
do VerifyEncoderContext
ds_OutputDebugString('avcodec_alloc_context3 OK', TRUE)

! Video settings *******************************************************************************************
do InitVideoSettings

assert(AV_CODEC_FLAG_GLOBAL_HEADER = bshift(1, 22), 'Check AV_CODEC_FLAG_GLOBAL_HEADER')
if band(formater.flags, AVFMT_GLOBALHEADER)
 encoder_ctxt.flags = bor(encoder_ctxt.flags, AV_CODEC_FLAG_GLOBAL_HEADER) !avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
end

! avcodec_open2 *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
Result = avcodec_open2(encoder_ctxt, encoder, 0)
if CHECK_STACK then ds_TestStack .
if Result < 0
 ds_OutputDebugString('avcodec_open2 failed. Result=' & Result, TRUE)
 stop('Could not open codec')
 exit
end
ds_OutputDebugString('avcodec_open2 OK', TRUE)

! av_frame_alloc *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
frame &= av_frame_alloc();
if CHECK_STACK then ds_TestStack .
if frame &= NULL
 ds_OutputDebugString('av_frame_alloc failed', TRUE)
 stop('Could not allocate video frame')
 exit
end
do VerifyFrame
frame.format = encoder_ctxt.pix_fmt
frame.width = encoder_ctxt.width
frame.height = encoder_ctxt.height
ds_OutputDebugString('av_frame_alloc OK', TRUE)

! av_frame_get_buffer *******************************************************************************************
if CHECK_STACK then ds_SaveStack .
Result = av_frame_get_buffer(frame, 32)
if CHECK_STACK then ds_TestStack .
if Result < 0
 ds_OutputDebugString('av_frame_get_buffer failed', TRUE)
 stop('Could not allocate video frame buffer Error = ' & Result)
 exit
end
do VerifyFrameBuffer
ds_OutputDebugString('av_frame_get_buffer OK', TRUE)

!frame->data offset=0 Array[8] of *int8_t
UseData0 &= (frame.data[1])
UseData1 &= (frame.data[2])
UseData2 &= (frame.data[3])

if CHECK_STACK then ds_SaveStack .
Result = avcodec_parameters_from_context(stream.codecpar, encoder_ctxt);
if CHECK_STACK then ds_TestStack .
if Result < 0
 ds_OutputDebugString('avcodec_parameters_from_context failed', TRUE)
 stop('Could not initialize stream parameters')
 exit
end
ds_OutputDebugString('avcodec_parameters_from_context OK', TRUE)

! av_dump_format *******************************************************************************************
ds_OutputDebugString('before call to av_dump_format file_name=' & file_name, TRUE)
av_dump_format(formater_ctxt, 0, file_name, 1)




I get a crash at last line - call to av_dump_format()



If I comment this code then I get a crash on the very next lib call :



! avio_open *******************************************************************************************
if not(band(formater.flags, AVFMT_NOFILE)) 
 ds_OutputDebugString('before call to avio_open file_name=' & file_name, TRUE)
 ThisInt &= address(formater_ctxt.pb)
 Result = avio_open(ThisInt, file_name, AVIO_FLAG_WRITE)




Strangely if I comment the setup call to av_log_set_callback(my_log_callback) then the crash moves down to the next lib call : avformat_write_header