Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Android : how to film a video before extracting its audio
20 février 2017, par MrOrgonDespite many searches, I haven't been able to develop a Android prototype able to film a video before extracting its audio as .wav in a separate activity.
I have developed so far a simple filming activity which relies on Android's Camera application. My strategty was to put the video's Uri as Extra to the next activity, before using FFMPEG, but I can't make the transition between Uri and FFMPEG. Indeed, I'm a fresh Android Studio beginner, so I still am not sure about what concept to use.
Here's my code for the video recording activity.
import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.MediaStore; import android.widget.Toast; import android.widget.VideoView; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; import static java.security.AccessController.getContext; public class RecordActivity extends Activity{ static final int REQUEST_VIDEO_CAPTURE = 0; VideoView mVideoView = null; Uri videoUri = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mVideoView = (VideoView) findViewById(R.id.videoVieww); setContentView(R.layout.activity_record); Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); Toast.makeText(RecordActivity.this, String.valueOf(Build.VERSION.SDK_INT) , Toast.LENGTH_SHORT).show(); takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri); if (takeVideoIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == REQUEST_VIDEO_CAPTURE && resultCode == RESULT_OK) { videoUri = intent.getData(); Intent intentForFilterActivity = new Intent(RecordActivity.this, FilterActivity.class); intentForFilterActivity.putExtra("VideoToFilter", videoUri.getPath()); startActivity(intentForFilterActivity); } } }
Here's the the code for the audio extraction activity. It is called "FilterActivity", as its final aim is to filter outdoor noise using additional functions. I'm using WritingMinds' implementation of FFMPEG. https://github.com/WritingMinds/ffmpeg-android-java
import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.test.ActivityUnitTestCase; import android.widget.Toast; import com.github.hiteshsondhi88.libffmpeg.ExecuteBinaryResponseHandler; import com.github.hiteshsondhi88.libffmpeg.FFmpeg; import com.github.hiteshsondhi88.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException; public class FilterActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_filter); Intent intentVideo = getIntent(); String pathIn = intentVideo.getStringExtra("VideoToFilter"); FFmpeg ffmpeg = FFmpeg.getInstance(FilterActivity.this); try { String[] cmdExtract = {"-i " + pathIn + " extracted.wav"}; ffmpeg.execute(cmdExtract, new ExecuteBinaryResponseHandler() { @Override public void onStart() {} @Override public void onProgress(String message) {} @Override public void onFailure(String message) { Toast.makeText(FilterActivity.this, "Failure !", Toast.LENGTH_SHORT).show(); } @Override public void onSuccess(String message) {} @Override public void onFinish() {} }); } catch (FFmpegCommandAlreadyRunningException e) { } } }
and I always get the "Failure !" message.
Some parts of the code may look extremely bad. As as written previously, I'm a real Android Studio beginner.
Do you have any correction that could work ? Or even just a strategy ?
Thank you in advance !
-
RTSP stream escape 1 or 2 seconds in output video file
20 février 2017, par A SahraI am trying to capture RTSP video from network path (rtsp://10.29.23.1/video) using ffmpeg framework
When i capture the video the output video file generated with ffmpeg is very low in quality and also it escape 1 or 2 seconds after each 5 seconds of the source video
The command that i am running is:
>#ffmpeg -i rtsp://10.20.2.2/aerovid -vcodec libx264 -framerate 5 -f mp4 public/out.mp4 Log:after running above command: [h264 @ 0x2b75640] P sub_mb_type 32 out of range at 16 1464 bitrate=226.8kbits/s dup=30 drop=0 speed=3.27x [h264 @ 0x2b75640] error while decoding MB 16 14 [h264 @ 0x2b75640] concealing 402 DC, 402 AC, 402 MV errors in P frame [h264 @ 0x2b75640] mb_type 52 in P slice too large at 0 379 bitrate=239.0kbits/s dup=48 drop=0 speed=1.65x [h264 @ 0x2b75640] error while decoding MB 0 3 [h264 @ 0x2b75640] concealing 869 DC, 869 AC, 869 MV errors in P frame [h264 @ 0x2b75640] out of range intra chroma pred mode [h264 @ 0x2b75640] error while decoding MB 34 1 [h264 @ 0x2b75640] concealing 917 DC, 917 AC, 917 MV errors in P frame [h264 @ 0x2b75640] P sub_mb_type 9 out of range at 9 5 [h264 @ 0x2b75640] error while decoding MB 9 5 [h264 @ 0x2b75640] concealing 778 DC, 778 AC, 778 MV errors in P frame [h264 @ 0x2b75640] negative number of zero coeffs at 9 1507 bitrate= 288.7kbits/s dup=50 drop=0 speed=1.37x [h264 @ 0x2b75640] error while decoding MB 9 15 [h264 @ 0x2b75640] concealing 368 DC, 368 AC, 368 MV errors in P frame [h264 @ 0x2b75640] out of range intra chroma pred mode [h264 @ 0x2b75640] error while decoding MB 12 3 [h264 @ 0x2b75640] concealing 857 DC, 857 AC, 857 MV errors in P frame [h264 @ 0x2b75640] mb_type 53 in P slice too large at 38 6 [h264 @ 0x2b75640] error while decoding MB 38 6 [h264 @ 0x2b75640] concealing 708 DC, 708 AC, 708 MV errors in P frame Invalid UE golomb code [h264 @ 0x2b75640] cbp too large (3199971767) at 28 12 [h264 @ 0x2b75640] error while decoding MB 28 12 [h264 @ 0x2b75640] concealing 472 DC, 472 AC, 472 MV errors in P frame
What is the reason and how to solve it please?
-
How to fix call lib ffmpeg by c#
20 février 2017, par Thang Transtring _a= -i "D:_InputFolder\Jamaican man talking the truth about #zika virus.mp4" -filter_complex "[0:a]atempo=0.9,volume=1.6,asetrate=r=44100*33.6/30,atempo=30/33.6,highpass=f=400,lowpass=f=4100,earwax,biquad,compensationdelay,equalizer=f=222:width_type=o:width=2:g=5,equalizer=f=444:width_type=h:width=220:g=5; setpts=PTS/0.9" -vcodec libx264 -pix_fmt yuv420p -r 30 -g 60 -b:v 1400k -profile:v main -level 3.1 -acodec libmp3lame -b:a 128k -ar 44100 -metadata title="" -metadata artist="" -metadata album_artist="" -metadata album="" -metadata date="" -metadata track="" -metadata genre="" -metadata publisher="" -metadata encoded_by="" -metadata copyright="" -metadata composer="" -metadata performer="" -metadata TIT1="" -metadata TIT3="" -metadata disc="" -metadata TKEY="" -metadata TBPM="" -metadata language="eng" -metadata encoder="" -threads 0 -preset superfast "D:_OutputFolder\videoOutput.mp4"
-----------this is the code goi goi sua sound in c # error
string _b= -i "D:_InputFolder\Jamaican man talking the truth about #zika virus.mp4" -acodec pcm_u8 -ar 22050 "D:_OutputFolder\videoOutput.wav" -- with code editing video style is back.
file class run ffmpeg call c# : string _result = ffmpeg.RunCommand(_b);//wordless
string _result2 = ffmpeg.RunCommand(_a);//error
file class call ffmpeg :
-file project demo error: https://drive.google.com/open?id=0B9dxSeLrFswjVmNGd1IzcUpncE0
thank you and sorry if my english is the poor
-
How to convert silk audio file from WeChat to amr format ?
20 février 2017, par hzwzwWhen I developing WeChat mini program, I want to achieve the voice control. but the audio provided by WeChat client is silk.
I need to convert the silk file to some format can be recognized by 3rd voice detection service.
Some 3rd services support amr format. It's really great, because the size could be very small.
-
After merge videos, the duration is too long - ffmpeg
20 février 2017, par Thanh DaoI have file txt with content
file intro.mp4 file video.mp4 file outtro.mp4
with duration by
10s
,178s
,13s
.I use ffmpeg to merge 3 files into one with below command:
ffmpeg -f concat -i "file.txt" -vcodec copy -acodec copy "endfile.mp4"
The duration of
endfile.mp4
is longer11
mins (660s
).I have a question that
which params of video affect to merge?
Andwhich common params to merge another videos?
My English really too bad. Sorry for it :)
Good working this week!P/S
Details infor of files:intro.mp4
:ffprobe version N-82885-g6d09d6e Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --
bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
libavutil 55. 43.100 / 55. 43.100
libavcodec 57. 68.100 / 57. 68.100
libavformat 57. 61.100 / 57. 61.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 68.100 / 6. 68.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/intro.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.23.100
Duration: 00:00:10.08, start: -0.013061, bitrate: 701 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 853 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
outtro.mp4
:ffprobe version N-82885-g6d09d6e Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --
bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
libavutil 55. 43.100 / 55. 43.100
libavcodec 57. 68.100 / 57. 68.100
libavformat 57. 61.100 / 57. 61.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 68.100 / 6. 68.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/outtro.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.23.100
Duration: 00:00:13.08, start: -0.013061, bitrate: 481 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 392 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
video.mp4
ffprobe version N-82885-g6d09d6e Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --
bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
libavutil 55. 43.100 / 55. 43.100
libavcodec 57. 68.100 / 57. 68.100
libavformat 57. 61.100 / 57. 61.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 68.100 / 6. 68.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'path/to/video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.61.100
Duration: 00:02:58.38, start: 0.000000, bitrate: 922 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 782 kb/s, 29.97 fps, 29.97 tbr, 30k
tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 130 kb/s (default)
Metadata:
handler_name : SoundHandler