
Recherche avancée
Autres articles (112)
-
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 -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.
Sur d’autres sites (7461)
-
H264 streamed video stutter and freeze with MediaCodec, Android 4.1.2
5 mars 2015, par WajihI have been trying my heart out to remove the stutter from an android RTSP client.
Here is my setup- FFMPEG server streams a live video on Win7. The video is 1200x900 in size. The video streamed is in H264 format.
- I receive the video packets on android (4.1.2) clinet under JNI which pushes the packet to java - Device is a Samsung Tab4
- Packets are decoded using MediaCodec. Once call from JNI to push the packets into MediaCodec, another thread in Java tries to de-queue the data and display them to a SurfaceView (its a GLSurfaceView)
Despite my efforts of using queue to buffer the packets, changing wait times to 0,-1, 1000000, i am unable to get a clean streamed video. I understand that there is some packet loss (1% to 10%), but I am getting a broken video, with stutter (some call it even jitter). Green patches, pink screens, gray slices. You name it, it is there, the problem seems to be exaggerated when there is a fast movement in the video.
At the moment I am not sure where the problem lies, I tried a windows version of the client (with ffmpeg decoding) and it works smoothly despite the packet loss.What am I doing wrong ? Any guidance is appreciated.
Below is the client end code for Android and the server end FFMPEG settings I read from a config file.// Function called from JNI
public int decodeVideo(byte[] data, int size, long presentationTimeUs, boolean rtpMarker, int flag)
{
if(vdecoder == null)
return -1;
if(currVInbufIdx == -1) {
vdecoderInbufIdx = vdecoder.dequeueInputBuffer(1000000); //1000000/*1s*/
if(vdecoderInbufIdx < 0) {
Log.d("log","decodeVideo@1: frame dropped");
vdecoderRet = -1;
return vdecoderRet;
}
currVInbufIdx = vdecoderInbufIdx;
currVPts = presentationTimeUs;
currVFlag = flag;
inputVBuffers[currVInbufIdx].clear();
}
vdecoderPos = inputVBuffers[currVInbufIdx].position();
vdecoderRemaining = inputVBuffers[currVInbufIdx].remaining();
if(flag==currVFlag && vdecoderRemaining >= size && currVPts == presentationTimeUs
&& rtpMarker == false
/*&&(pos < vbufferLevel || vbufferLevel<=0)*/)
{
/* Queue without decoding */
inputVBuffers[currVInbufIdx].put(data, 0,size);
}
else
{
if(flag==currVFlag && vdecoderRemaining >= size && currVPts == presentationTimeUs
&& rtpMarker)
{
inputVBuffers[currVInbufIdx].put(data, 0, size);
queued = true;
}
Log.d("log", "decodeVideo: submit,"
+ " pts=" + Long.toString(currVPts)
+ " position="+inputVBuffers[currVInbufIdx].position()
+ " capacity="+inputVBuffers[currVInbufIdx].capacity()
+ " VBIndex="+currVInbufIdx
);
vdecoder.queueInputBuffer(currVInbufIdx, 0, inputVBuffers[currVInbufIdx].position(), currVPts, currVFlag);
//
vdecoderInbufIdx = vdecoder.dequeueInputBuffer(1000000);//1000000/*1s*/
if(vdecoderInbufIdx >= 0)
{
currVInbufIdx = vdecoderInbufIdx;
currVPts = presentationTimeUs;
currVFlag = flag;
inputVBuffers[currVInbufIdx].clear();
//if(queued == false)
{
inputVBuffers[vdecoderInbufIdx].put(data, 0, size);
}
}
else
{
currVInbufIdx = -1;
currVPts = -1;
vdecoderRet = -1;
Log.d("log","decodeVideo@2: frame dropped");
}
}
return vdecoderRet;
}And here we have the thread that calls for a render
// Function at android. Called by a separate thread.
private void videoRendererThreadProc() {
if(bufinfo == null)
bufinfo = new MediaCodec.BufferInfo();
videoRendered = false;
Log.d("log", "videoRenderer started.");
while(!Thread.interrupted() && !quitVideoRenderer)
{
Log.d("log", "videoRendererThreadProc");
outbufIdx = vdecoder.dequeueOutputBuffer(bufinfo,1000000);//500000
switch (outbufIdx)
{
case MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED:
Log.d("log", "decodeVideo: output buffers changed.");
// outputBuffers = vdecoder.getOutputBuffers();
break;
case MediaCodec.INFO_OUTPUT_FORMAT_CHANGED:
Log.d("log", "decodeVideo: format changed - " + vdecoder.getOutputFormat());
break;
case MediaCodec.INFO_TRY_AGAIN_LATER:
// Log.d("log", "decodeVideo: try again later.");
break;
default:
// decoded or rendered
videoRendered = true;
vdecoder.releaseOutputBuffer(outbufIdx, true);
//Log.d("log", "decodeVideo: Rendering...!!!.");
}
}
// flush decoder
//vdecoder.queueInputBuffer(0, 0, 0, 0, MediaCodec.BUFFER_FLAG_END_OF_STREAM);
outbufIdx = vdecoder.dequeueOutputBuffer(bufinfo, 1000000);//10000
if(outbufIdx >= 0)
{
vdecoder.releaseOutputBuffer(outbufIdx, true);
}
bufinfo = null;
videoRendered = false;
//
Log.d("log", "videoRenderer terminated.");
}And the ffmpeg setting at server at as follows.
[slices] = 4 # --slices
[threads] = 4 # --threads
[profile] = high # --profile main|baseline
[preset] = faster # --preset faster|ultrafast
[tune] = zerolatency # --tune -
FFMPEG sound not playing in video converted from audio in browsers (chrome/firefox) except safari
7 février 2019, par Bhavik RathodSound not playing in Video (mp4) converted from Audio (mp3), Below is my code
I am using FFMPEG version 4.1
ffmpeg -y -loop 1 -i background.jpg -i dia.mp3 -c:v libx264 -tune stillimage -pix_fmt yuv420p -c:a ac3_fixed -b:a 128k -shortest -vf "[in]drawtext=text=Hi:x=(w-text_w)/2:y=(h-text_h):fontfile=arial.ttf:fontsize=100:fontcolor=ffffff:alpha='if(lt(t,9.2763066666667),0,if(lt(t,9.2763066666667+1),(t-9.2763066666667)/1,if(lt(t,12.83428),1,if(lt(t,12.83428+1),(1-(t-12.83428))/1,0))))'" output.mp4 2>&1
I have tried putting -movflags +faststart as an output option
I am using
ac3_fixed
because i found that fix for handle memory management, My server is getting hang on usingaac
no video created nothing i have to restart instance to get back to work. by usingac3_fixed
everything is perfect but issue is only sound playing in chrome and firefox.Below is full log while using
aac
`ffmpeg version 4.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, image2, from '/var/www/html/xxxxx/assets/media/guest/e0ce3bfdab4b305d00459328afb94ca6.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 196382 kb/s
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
[mp3 @ 0x5970440] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from '/var/www/html/xxxxx/assets/media/guest/e0ce3bfdab4b305d00459328afb94ca6.mp3':
Metadata:
title : In the Cafe
album : British Council
genre : Blues
Duration: 00:01:02.77, start: 0.000000, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
[swscaler @ 0x5b91ec0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x598e640] using SAR=1/1
[libx264 @ 0x598e640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x598e640] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x598e640] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:-3:-3 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=2.00:0.70 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-4 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.20
Output #0, mp4, to '/var/www/html/xxxxx/assets/media/guest/created_video/e0ce3bfdab4b305d00459328afb94ca6.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.35.100 aac
frame= 14 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 28 fps= 27 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 42 fps= 27 q=28.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 44 fps= 21 q=28.0 size= 256kB time=00:00:00.02 bitrate=72266.5kbitsframe= 49 fps= 19 q=28.0 size= 256kB time=00:00:00.20 bitrate=10323.8kbitsframe= 55 fps= 18 q=28.0 size= 256kB time=00:00:00.48 bitrate=4353.4kbits/frame= 62 fps= 17 q=28.0 size= 256kB time=00:00:00.72 bitrate=2890.7kbits/frame= 68 fps= 16 q=28.0 size= 256kB time=00:00:01.00 bitrate=2088.6kbits/
` -
FFMPEG-jpg sequence to H.264 generate best result
18 octobre 2015, par ZikiI have a jpg sequence which I need to convert to mp4, and I need to get the best result.
As I understood, I need to supply the ’ffmpeg’ cmdln the following : bitrate, minrate, maxrate and bufsize.
The only thing that I found about calculating the above params, is if I have the final output file size. But considering I want the best quality, I don’t know the final output file size, and I don’t care what it will be.
Of course I have the framerate and the total frames.
Here’s my ffmpeg cmdln :
ffmpeg
-r 24
-start_number 0
-i "C:\pathToSequence\%06d.jpg"
-c copy
-vframes 792
-threads 16
-pix_fmt yuv420p
-c:v libx264
"C:\pathToOutput\result.mp4"The total size of the sequence is 128MB, 792 frames, 24 framerate, resolution 1280x720.
Until now I used to add the following to the ffmpeg cmdln :
-b:v 10000k -minrate 10000k -maxrate 10000k -bufsize 10000k
And if it was 1080p :
-b:v 20000k -minrate 20000k -maxrate 20000k -bufsize 20000k
And I figured that if I put the max value that ffmpeg can handle (2147480) it will generate almost the same result as the above. But I think it’s a bad approach(correct me if I’m wrong).
So if I need to get the best result, how do I calculate it(or I can simply put the max value) ?
Also I would like if you have another helpful flags to add to make the best final result.
—EDIT—
Here’s the updated command :
O:\tools\ffmpeg -framerate 24 -start_number 0 -i "C:\share\localProcess\test\%05d.jpg" -vframes 54 -pix_fmt yuv420p -c:v libx264 -preset veryslow -qp 1 "C:\share\localProcess\result\result.mp4"
And this is the ouptout :
ffmpeg version N-72383-g7206b94 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 26.100 / 54. 26.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 33.101 / 56. 33.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, image2, from 'C:\share\localProcess\test\%05d.jpg':
Duration: 00:00:02.25, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 72:72 DAR 16:9], 24 fps, 24 tbr, 24 tbn, 24 tbc
[swscaler @ 0000000004d6bf60] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0000000004d7a9e0] using SAR=1/1
[libx264 @ 0000000004d7a9e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000004d7a9e0] profile High, level 5.0
[libx264 @ 0000000004d7a9e0] 264 - core 146 r2538 121396c - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=9 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=1 ip_ratio=1.40 pb_ratio=1.30 aq=0
Output #0, mp4, to 'C:\share\localProcess\result\result.mp4':
Metadata:
encoder : Lavf56.33.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc
Metadata:
encoder : Lavc56.41.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 54 fps= 38 q=-1.0 Lsize= 542kB time=00:00:02.16 bitrate=2050.0kbits/s
video:541kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.251171%
[libx264 @ 0000000004d7a9e0] frame I:1 Avg QP: 0.00 size: 23629
[libx264 @ 0000000004d7a9e0] frame P:22 Avg QP: 1.00 size: 16146
[libx264 @ 0000000004d7a9e0] frame B:31 Avg QP: 2.81 size: 5623
[libx264 @ 0000000004d7a9e0] consecutive B-frames: 16.7% 29.6% 16.7% 0.0% 9.3% 0.0% 13.0% 14.8% 0.0%
[libx264 @ 0000000004d7a9e0] mb I I16..4: 74.9% 20.2% 4.9%
[libx264 @ 0000000004d7a9e0] mb P I16..4: 0.3% 0.1% 1.2% P16..4: 2.7% 0.4% 0.8% 0.2% 0.1% skip:94.2%
[libx264 @ 0000000004d7a9e0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 3.0% 0.4% 0.5% direct: 0.3% skip:95.7% L0:56.0% L1:40.5% BI: 3.5%
[libx264 @ 0000000004d7a9e0] 8x8 transform intra:16.5% inter:18.4%
[libx264 @ 0000000004d7a9e0] direct mvs spatial:54.8% temporal:45.2%
[libx264 @ 0000000004d7a9e0] coded y,uvDC,uvAC intra: 33.9% 49.8% 49.5% inter: 1.3% 2.9% 2.9%
[libx264 @ 0000000004d7a9e0] i16 v,h,dc,p: 79% 13% 4% 4%
[libx264 @ 0000000004d7a9e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 22% 48% 2% 4% 6% 3% 1% 2%
[libx264 @ 0000000004d7a9e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 13% 43% 5% 6% 4% 5% 5% 6%
[libx264 @ 0000000004d7a9e0] i8c dc,h,v,p: 78% 12% 7% 3%
[libx264 @ 0000000004d7a9e0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000004d7a9e0] ref P L0: 65.7% 2.4% 8.9% 4.5% 2.3% 3.0% 2.8% 3.9% 3.5% 0.8% 0.3% 0.5% 0.3% 0.5% 0.2% 0.3%
[libx264 @ 0000000004d7a9e0] ref B L0: 76.9% 12.0% 3.4% 0.7% 3.6% 0.5% 2.1% 0.4% 0.1% 0.0% 0.1% 0.0% 0.1% 0.1%
[libx264 @ 0000000004d7a9e0] ref B L1: 98.2% 1.8%
[libx264 @ 0000000004d7a9e0] kb/s:1966.80