Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Convert WebM/H.264 to MP4/H.264 efficiently with ffmpeg.js
31 juillet 2017, par SB2055As a result of the answer here: Recording cross-platform (H.264?) videos using WebRTC MediaRecorder
How can one go about using
ffmpeg.js
to efficiently unwrap awebm
h.264
video and re-wrap it into anmp4
container?I'm looking through the docs: https://github.com/Kagami/ffmpeg.js?files=1
However I don't see (or perhaps I'm looking for the wrong terminology) any examples for the above. This operation will be performed on the browser (chrome) prior to uploading as a
Blob
- I could use a web worker though hopefully rewrapping is a trivial enough operation to not require it. -
FFmpeg - CRF Command for Nvenc encode ? [migrated]
31 juillet 2017, par hongducwbMy current command for resize videos, 1080p 2GB to 300MB but it take a lot of time on my CPU
mkdir newfiles
for %%a in ("*.mp4") do ffmpeg -i "%%a" -c:v libx264 -preset slow -crf 21 c:a aac -b:a 128k -vf scale=678:-2 "newfiles\%%~na.mp4"
pausei try nvenc with my 1070.
mkdir newfiles
for %%a in ("*.mp4") do ffmpeg -i "%%a" -c:v h264_nvenc -preset slow -c:a aac -b:a 128k -vf scale=678:-2 "newfiles\%%~na.mp4"
pauseoutput size always 3x or 5x original size, nvenc not working with -crf
so anyone know command to resize/convert video with high quality and small size ?
and should i use gpu for encoding ?THANK
-
ffmpeg showing "Error initializing output stream 0:0"
31 juillet 2017, par user2565010I am running the following command
ffmpeg -i DJI_0001.MOV DJI_0001.mp4
in order to convert the video to mp4 from MOV with no other property changes.
The issue is that I am getting:
ffmpeg version N-86863-g2ba20d799a-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers built with gcc 6.4.0 (Debian 6.4.0-2) 20170724 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-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg libavutil 55. 69.100 / 55. 69.100 libavcodec 57.102.100 / 57.102.100 libavformat 57. 76.100 / 57. 76.100 libavdevice 57. 7.100 / 57. 7.100 libavfilter 6. 95.100 / 6. 95.100 libswscale 4. 7.101 / 4. 7.101 libswresample 2. 8.100 / 2. 8.100 libpostproc 54. 6.100 / 54. 6.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DJI_0001.MOV': Metadata: major_brand : qt minor_version : 538182144 compatible_brands: qt creation_time : 2017-07-23T17:04:58.000000Z location : location-{ : comment : 0.9.142 Duration: 00:00:17.89, start: 0.000000, bitrate: 60017 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 4096x2160 [SAR 1:1 DAR 256:135], 60014 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default) Metadata: creation_time : 2017-07-23T17:04:58.000000Z handler_name : DJI.AVC encoder : Dji AVC encoder File 'DJI_0001.mp4' already exists. Overwrite ? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Press [q] to stop, [?] for help [libx264 @ 0x3ed56a0] using SAR=1/1 [libx264 @ 0x3ed56a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed!
I see no other error message that would indicate an underlying problem. Could anybody please give me some info on how should I fix it?
-
FFMPEG skipping chunks from the video
31 juillet 2017, par Swapnil KondeWe are transcoding videos by using the following command:
ffmpeg -y -i cccb3694bbc74dcdbecf3d99851f529e_17504 -loglevel error -c:v libx264 -pix_fmt yuv420p -movflags +faststart -preset medium -b:v 1560k -crf 24 -pass 1 -passlogfile cccb3694bbc74dcdbecf3d99851f529e_17504.log -c:a aac -b:a 256k -s 400x720 -f mp4 /dev/null 2>&1 && ffmpeg -y -i cccb3694bbc74dcdbecf3d99851f529e_17504 -loglevel error -c:v libx264 -pix_fmt yuv420p -movflags +faststart -preset medium -b:v 1560k -crf 24 -pass 2 -passlogfile cccb3694bbc74dcdbecf3d99851f529e_17504.log -c:a aac -b:a 256k -s 400x720 cccb3694bbc74dcdbecf3d99851f529e_17504.mp4 2>&1
And while streaming we are creating chunks which consist below steps:
- decoding the frames and
- changing the bandwidth as per our convenience and
- encoding the packet again.
But we are observing frame skipping in chunks, which makes video shorter by 1 or 2 seconds. We have used ffmpeg 3.0 and transcoding examples given on the ffmpeg site.
-
c# ffmpeg encode/decode audio and video
31 juillet 2017, par IC.FulvioI'm writing C# code to stream audio and video through RTSP. I use ffmpe.Autogen wrapper and NAudio. With the video I have no problem, hevc
25fps
.About audio, I capture audio samples with NAudio and after, I copy the buffer in the AVframe data of ffmpeg. The audio codec that I use is:
AAC f32le 44,1 khz
. When I encode, in the main loop, I write one video frame and after one audio frame.while (video_st != null) { img1.CopyTo(imgframe); var startFrame = DateTime.Now; ret = Utility_ffmpeg.write_video_frame(outContext, video_st, frameCount, &dst_picture, frame, ref imgframe, sws_ctx); if (ret < 0) { Debug.WriteLine("Write video frame failed.\n"); return; } var streamDuration = DateTime.Now - startSend; //audio if (enable_audio && srcAudio.audio_buff != null) { if (srcAudio.audio_buff_dim > 0) { lock (srcAudio.audio_buff) { frameCount++; Utility_ffmpeg.write_audio_frame(outContext, srcAudio.audio_buff, srcAudio.audio_buff_dim, audio_st, frameCount); } } } Debug.WriteLine("Elapsed time " + streamDuration + ", video stream pts " + video_st->pts.val + ".\n"); var frameDuration = DateTime.Now - startFrame; Debug.WriteLine(frameDuration+" total \n"); //System.Threading.Thread.Sleep((int)((long)1000.0 / (long)STREAM_FRAME_RATE - (long)frameDuration.TotalSeconds)); System.Threading.Thread.Sleep(40); //} }
When I decode the video all is ok but the audio comes and goes. The synchronization is ok. I think the problem is that I need to send more audio frame then video, but I'm not sure. Someone has an idea about the origin of the problem? Thanks in advance and sorry for my English.