
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (28)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Soumettre améliorations et plugins supplémentaires
10 avril 2011Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)
Sur d’autres sites (6085)
-
How to convert H264 RTP stream from PCAP to a playable video file
21 août 2014, par yooshaI have captured stream of H264 in PCAP files and trying to create media files from the data. The container is not important (avi,mp4,mkv,…).
When I’m using videosnarf or rtpbreak (combined with python code that adds 00 00 00 01 before each packet) and then ffmpeg, the result is OK only if the input frame rate is constant (or near constant). However, when the input is vfr, the result plays too fast (and on same rare cases too slow).
For example :videosnarf -i captured.pcap –c
ffmpeg -i H264-media-1.264 output.aviAfter doing some investigation of the issue I believe now that since the videosnarf (and rtpbreak) are removing the RTP header from the packets, the timestamp is lost and ffmpeg is referring to the input data as cbr.
- I would like to know if there is a way to pass (on a separate file ?)
the timestamps vector or any other information to ffmpeg so the
result will be created correctly ? - Is there any other way I can take the data out of the PCAP file and play it or convert it and then play it ?
- Since all work is done in Python, any suggestion of libraries/modules that can help with the work (even if requires some codding) is welcome as well.
Note : All work is done offline, no limitations on the output. It can be cbr/vbr, any playable container and transcoding. The only "limitation" I have : it should all run on linux…
Thanks
YSome additional information :
Since the nothing provides the FFMPEG with the timestamp data, i decided to try a different approach : skip videosnarf and use Python code to pipe the packets directly to ffmpeg (using the "-f -i -" options) but then it refuses to accept it unless I provide an SDP file...
How do I provide the SDP file ? is it an additional input file ? ("-i config.sdp")The following code is an unsuccessful try doing the above :
import time
import sys
import shutil
import subprocess
import os
import dpkt
if len(sys.argv) < 2:
print "argument required!"
print "txpcap <pcap file="file">"
sys.exit(2)
pcap_full_path = sys.argv[1]
ffmp_cmd = ['ffmpeg','-loglevel','debug','-y','-i','109c.sdp','-f','rtp','-i','-','-na','-vcodec','copy','p.mp4']
ffmpeg_proc = subprocess.Popen(ffmp_cmd,stdout = subprocess.PIPE,stdin = subprocess.PIPE)
with open(pcap_full_path, "rb") as pcap_file:
pcapReader = dpkt.pcap.Reader(pcap_file)
for ts, data in pcapReader:
if len(data) < 49:
continue
ffmpeg_proc.stdin.write(data[42:])
sout, err = ffmpeg_proc.communicate()
print "stdout ---------------------------------------"
print sout
print "stderr ---------------------------------------"
print err
</pcap>In general this will pipe the packets from the PCAP file to the following command :
ffmpeg -loglevel debug -y -i 109c.sdp -f rtp -i - -na -vcodec copy p.mp4
SDP file : [RTP includes dynamic payload type # 109, H264]
v=0
o=- 0 0 IN IP4 ::1
s=No Name
c=IN IP4 ::1
t=0 0
a=tool:libavformat 53.32.100
m=video 0 RTP/AVP 109
a=rtpmap:109 H264/90000
a=fmtp:109
packetization-mode=1 ;profile-level-id=64000c ;sprop-parameter-sets=Z2QADKwkpAeCP6wEQAAAAwBAAAAFI8UKkg==,aMvMsiw= ;
b=AS:200Results :
ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 20 2012 04:34:50 with gcc 4.4.6 20110731 (Red Hat
4.4.6-3) configuration : —prefix=/usr —libdir=/usr/lib64 —shlibdir=/usr/lib64 —mandir=/usr/share/man —enable-shared —enable-runtime-cpudetect —enable-gpl —enable-version3 —enable-postproc —enable-avfilter —enable-pthreads —enable-x11grab —enable-vdpau —disable-avisynth —enable-frei0r —enable-libopencv —enable-libdc1394 —enable-libdirac —enable-libgsm —enable-libmp3lame —enable-libnut —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-librtmp —enable-libschroedinger —enable-libspeex —enable-libtheora —enable-libvorbis —enable-libvpx —enable-libx264 —enable-libxavs —enable-libxvid —extra-cflags=’-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector —param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC’ —disable-stripping libavutil 51. 35.100 / 51. 35.100 libavcodec 53. 61.100 / 53. 61.100 libavformat 53. 32.100
/ 53. 32.100 libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 61.100 / 2. 61.100 libswscale 2. 1.100
/ 2. 1.100 libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100 [sdp @ 0x15c0c00] Format sdp
probed with size=2048 and score=50 [sdp @ 0x15c0c00] video codec set
to : h264 [NULL @ 0x15c7240] RTP Packetization Mode : 1 [NULL @
0x15c7240] RTP Profile IDC : 64 Profile IOP : 0 Level : c [NULL @
0x15c7240] Extradata set to 0x15c78e0 (size : 36) !error,_recognition
separate : 1 ; 1 [h264 @ 0x15c7240] error,_recognition combined : 1 ;
10001 [sdp @ 0x15c0c00] decoding for stream 0 failed [sdp @
0x15c0c00] Could not find codec parameters (Video : h264) [sdp @
0x15c0c00] Estimating duration from bitrate, this may be inaccurate
109c.sdp : could not find codec parameters Traceback (most recent
call last) : File "./ffpipe.py", line 26, in
ffmpeg_proc.stdin.write(data[42 :]) IOError : [Errno 32] Broken pipe(forgive the mass above, the editor keep on complaining about code that is not indented OK ??)
I’m working on this issue for days... any help/suggestion/hint will be appreciated.
- I would like to know if there is a way to pass (on a separate file ?)
-
Memory leak while opening encoders in ffmpeg
22 janvier 2014, par praks411I'm getting memory leaks in avcodec_find_encoder. Although I'm cleaning the resources properly
still I'm not able to get rid of the leak. By successive commenting the code I found that memory leaks happen only after the call of avcodec_find_encoder(). I've tried my code with different video files and I found that memory leaks blocks are always same. Also if I open only audio or video then I get just one memory leaks block.
Below is the part of Init and Clean-up code from the application.
Note that this is just part of code which contains initialization and resource release.AVFormatContext *m_informat;
AVFormatContext *m_outformat;
AVStream *m_in_vid_strm, *m_out_vid_strm;
AVStream *m_in_aud_strm, *m_out_aud_strm;
int VideoClipper::Init(const wxString& filename)
{
int ret = 0;
char errbuf[64];
av_register_all();
if ((ret = avformat_open_input( &m_informat, filename.mb_str(), 0, 0)) != 0 )
{
av_strerror(ret,errbuf,sizeof(errbuf));
PRINT_VAL("Not able to Open file;; ", errbuf)
ret = -1;
return ret;
}
else
{
PRINT_MSG("Opened File ")
}
if ((ret = avformat_find_stream_info(m_informat, 0))< 0 )
{
av_strerror(ret,errbuf,sizeof(errbuf));
PRINT_VAL("Not Able to find stream info:: ", errbuf)
ret = -1;
return ret;
}
else
{
PRINT_MSG("Got stream Info ")
}
for(unsigned int i = 0; inb_streams; i++)
{
if(m_informat->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
{
PRINT_MSG("Found Video Stream ")
m_in_vid_strm_idx = i;
m_in_vid_strm = m_informat->streams[i];
}
if(m_informat->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
{
PRINT_MSG("Found Audio Stream ")
m_in_aud_strm_idx = i;
m_in_aud_strm = m_informat->streams[i];
}
}
AVOutputFormat *outfmt = NULL;
std::string outfile = std::string(filename) + "clip_out.avi";
outfmt = av_guess_format(NULL,outfile.c_str(),NULL);
if(outfmt == NULL)
{
ret = -1;
return ret;
}
else
{
m_outformat = avformat_alloc_context();
if(m_outformat)
{
m_outformat->oformat = outfmt;
_snprintf(m_outformat->filename, sizeof(m_outformat->filename), "%s", outfile.c_str());
}
else
{
ret = -1;
return ret;
}
}
AVCodec *out_vid_codec,*out_aud_codec;
out_vid_codec = out_aud_codec = NULL;
if(outfmt->video_codec != AV_CODEC_ID_NONE && m_in_vid_strm != NULL)
{
out_vid_codec = avcodec_find_encoder(outfmt->video_codec);
if(NULL == out_vid_codec)
{
PRINT_MSG("Could Not Find Vid Encoder")
ret = -1;
return ret;
}
else
{
PRINT_MSG("Found Out Vid Encoder ")
m_out_vid_strm = avformat_new_stream(m_outformat, out_vid_codec);
if(NULL == m_out_vid_strm)
{
PRINT_MSG("Failed to Allocate Output Vid Strm ")
ret = -1;
return ret;
}
else
{
PRINT_MSG("Allocated Video Stream ")
if(avcodec_copy_context(m_out_vid_strm->codec, m_informat->streams[m_in_vid_strm_idx]->codec) != 0)
{
PRINT_MSG("Failed to Copy Context ")
ret = -1;
return ret;
}
}
}
}
if(outfmt->audio_codec != AV_CODEC_ID_NONE && m_in_aud_strm != NULL)
{
out_aud_codec = avcodec_find_encoder(outfmt->audio_codec);
if(NULL == out_aud_codec)
{
PRINT_MSG("Could Not Find Out Aud Encoder ")
ret = -1;
return ret;
}
else
{
PRINT_MSG("Found Out Aud Encoder ")
m_out_aud_strm = avformat_new_stream(m_outformat, out_aud_codec);
if(NULL == m_out_aud_strm)
{
PRINT_MSG("Failed to Allocate Out Vid Strm ")
ret = -1;
return ret;
}
else
{
if(avcodec_copy_context(m_out_aud_strm->codec, m_informat->streams[m_in_aud_strm_idx]->codec) != 0)
{
PRINT_MSG("Failed to Copy Context ")
ret = -1;
return ret;
}
}
}
}
if (!(outfmt->flags & AVFMT_NOFILE))
{
if (avio_open2(&m_outformat->pb, outfile.c_str(), AVIO_FLAG_WRITE,NULL, NULL) < 0)
{
PRINT_VAL("Could Not Open File ", outfile)
ret = -1;
return ret;
}
}
/* Write the stream header, if any. */
if (avformat_write_header(m_outformat, NULL) < 0)
{
PRINT_VAL("Error Occurred While Writing Header ", outfile)
ret = -1;
return ret;
}
else
{
PRINT_MSG("Written Output header ")
m_init_done = true;
}
return ret;
}Here is the Clean-up part
void VideoClipper::ReleaseResource(void)
{
if(m_in_aud_strm && m_in_aud_strm->codec)
{
avcodec_close(m_in_aud_strm->codec);
PRINT_MSG("Closed Input Audio Codec ")
}
if(m_in_vid_strm && m_in_vid_strm->codec)
{
avcodec_close(m_in_vid_strm->codec);
PRINT_MSG("Closed Input Video Codec ")
}
if(m_informat)
{
avformat_close_input(&m_informat);
PRINT_MSG("Freed Input Format Contex ")
}
if(m_out_aud_strm && m_out_aud_strm->codec)
{
avcodec_close(m_out_aud_strm->codec);
PRINT_MSG("Closed Output Audio Codec ")
}
if(m_out_vid_strm && m_out_vid_strm->codec)
{
avcodec_close(m_out_vid_strm->codec);
PRINT_MSG("Closed Output Audio Codec ")
}
if(m_outformat)
{
avformat_close_input(&m_outformat);
m_outformat = NULL;
PRINT_MSG("Closed Output Format ")
}
}Memory Leaks message
Detected memory leaks!
Dumping objects ->
{13691} normal block at 0x01046A60, 4479 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
{13685} normal block at 0x01043FD0, 10831 bytes long.
Data: < ? > CD CD CD CD CD CD CD CD D0 3F 04 01 ED ED ED ED
Object dump complete.I'm using latest version of ffmpeg on Visual Studio 2012.
Please suggest where I'm missing.Thanks
Pradeep -
FFMPEG SCREENSHOT GENERATE ERROR : No such filter : 'tile' [duplicate]
23 mai 2013, par itseasy21This question is an exact duplicate of :
i have been trying on making multiple screenshots from a video file using ffmpeg and i succeed too in command but the only problem is while executing that i am getting this error :
No such filter: 'tile'
Error opening filters!The command i execute is :
ffmpeg -ss 00:00:10 -i './tmp/try.avi' -vcodec mjpeg -vframes 1 -vf 'select=not(mod(n\,1000)),scale=320:240,tile=2x3' './tmp/try.jpg'
The output i get is :
xxxxx@xxxx.com [~/public_html/xxxx]# ffmpeg -ss 00:00:10 -i './tmp/try.avi' -vcodec mjpeg -vframes 1 -vf 'select=not(mod(n\,1000)),scale=320:240,tile=2x3' './tmp/try.jpg'
ffmpeg version 0.7.11, Copyright (c) 2000-2011 the FFmpeg developers
built on Mar 10 2012 18:07:20 with gcc 4.4.6 20110731 (Red Hat 4.4.6-3)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libdirac --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping
libavutil 50. 43. 0 / 50. 43. 0
libavcodec 52.123. 0 / 52.123. 0
libavformat 52.111. 0 / 52.111. 0
libavdevice 52. 5. 0 / 52. 5. 0
libavfilter 1. 80. 0 / 1. 80. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 0 codec frame rate differs from container frame rate: 29.97 (30000/1001) -> 25.00 (25/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './tmp/try.avi':
Metadata:
major_brand : 3gp4
minor_version : 512
compatible_brands: isomiso23gp4
creation_time : 1970-01-01 00:00:00
Duration: 00:09:24.82, start: 0.000000, bitrate: 118 kb/s
Stream #0.0(und): Video: h263, yuv420p, 176x144 [PAR 12:11 DAR 4:3], 102 kb/s, 25 fps, 25 tbr, 25 tbn, 29.97 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream #0.1(und): Audio: amrnb, 8000 Hz, 1 channels, flt, 12 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
[buffer @ 0x1ad89a0] w:176 h:144 pixfmt:yuv420p tb:1/1000000 sar:12/11 sws_param:
No such filter: 'tile'
Error opening filters!any solution for this ????