ffmpegFrameRecorder

946 views
Skip to first unread message

Tomasz Skulimowski

unread,
Aug 28, 2013, 2:29:40 PM8/28/13
to jav...@googlegroups.com
Hi,
 I'am working with ffmpegframerecorder and recordActivity. It allows to record video with audio in AAC format. Is it possible to change it to the mp3 format. I tried:

recorder.setAudioCodec(AV_CODEC_ID_MP3);

but I receive 

08-28 20:32:59.939: W/System.err(30703): com.googlecode.javacv.FrameRecorder$Exception: avcodec_find_encoder() error: Audio codec not found.

Best regards,
Tomasz

Samuel Audet

unread,
Aug 31, 2013, 9:16:10 PM8/31/13
to jav...@googlegroups.com
Hello,
We need a version of FFmpeg that has been built with libmp3lame for that
to work, and that doesn't seem to be the case of the version you are
using unfortunately..

Samuel

Venkata Reddy Nallamilli

unread,
Jan 18, 2014, 12:40:35 AM1/18/14
to jav...@googlegroups.com
hi Samuel:

I follow this site for sending the live video from android to other server.

in that they are using this code 
recorder = new FFmpegFrameRecorder(ffmpeg_link, imageWidth, imageHeight, 1);
        recorder.setFormat("flv");
        recorder.setSampleRate(sampleAudioRateInHz);
        // Set in the surface changed method
        recorder.setFrameRate(frameRate); while i am checking the video at server side it says: Sorenson-H263 is not compatible with HLS. You should have H264-encoded video.
then i changed that code like this way: recorder.setVideoCodec(13); recorder.setFormat("mp4"); recorder.setPixelFormat(avutil.PIX_FMT_YUV420P); recorder.setFrameRate(12); recorder.setVideoBitrate(10 * 1024 * 1024); i am getting this error. "com.googlecode.javacv.FrameRecorder$Exception: avcodec_find_encoder() error: Video codec not found".

Samuel Audet

unread,
Jan 19, 2014, 1:45:26 AM1/19/14
to jav...@googlegroups.com
On 01/18/2014 02:40 PM, Venkata Reddy Nallamilli wrote:
hi Samuel:

I follow this site for sending the live video from android to other server.

in that they are using this code 
recorder = new FFmpegFrameRecorder(ffmpeg_link, imageWidth, imageHeight, 1);
        recorder.setFormat("flv");
        recorder.setSampleRate(sampleAudioRateInHz);
        // Set in the surface changed method
        recorder.setFrameRate(frameRate); while i am checking the video at server side it says: Sorenson-H263 is not compatible with HLS. You should have H264-encoded video.
then i changed that code like this way: recorder.setVideoCodec(13); recorder.setFormat("mp4"); recorder.setPixelFormat(avutil.PIX_FMT_YUV420P); recorder.setFrameRate(12); recorder.setVideoBitrate(10 * 1024 * 1024); i am getting this error. "com.googlecode.javacv.FrameRecorder$Exception: avcodec_find_encoder() error: Video codec not found".
You need to call  recorder.setVideoCodec(AV_CODEC_ID_H264)  if you want to use the H.264 codec. The number 13 isn't the H.264 codec.

Samuel

Venkata Reddy Nallamilli

unread,
Jan 19, 2014, 11:20:49 PM1/19/14
to jav...@googlegroups.com


While i am setting  recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264) ;
I am getting this error.

01-20 09:49:06.972: W/System.err(5908): com.googlecode.javacv.FrameRecorder$Exception: avcodec_find_encoder() error: Video codec not found.
01-20 09:49:06.982: W/System.err(5908): at com.googlecode.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:297)
01-20 09:49:06.982: W/System.err(5908): at com.venkatinfo.livestreaming.LiveStreaming.startRecording(LiveStreaming.java:228)
01-20 09:49:06.982: W/System.err(5908): at com.venkatinfo.livestreaming.LiveStreaming.onClick(LiveStreaming.java:266)
01-20 09:49:06.982: W/System.err(5908): at android.view.View.performClick(View.java:4438)
01-20 09:49:06.982: W/System.err(5908): at android.view.View$PerformClick.run(View.java:18422)
01-20 09:49:06.982: W/System.err(5908): at android.os.Handler.handleCallback(Handler.java:733)
01-20 09:49:06.982: W/System.err(5908): at android.os.Handler.dispatchMessage(Handler.java:95)
01-20 09:49:06.982: W/System.err(5908): at android.os.Looper.loop(Looper.java:136)
01-20 09:49:06.982: W/System.err(5908): at android.app.ActivityThread.main(ActivityThread.java:5017)
01-20 09:49:06.982: W/System.err(5908): at java.lang.reflect.Method.invokeNative(Native Method)
01-20 09:49:06.982: W/System.err(5908): at java.lang.reflect.Method.invoke(Method.java:515)
01-20 09:49:06.982: W/System.err(5908): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-20 09:49:06.982: W/System.err(5908): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-20 09:49:06.982: W/System.err(5908): at dalvik.system.NativeStart.main(Native Method)
01-20 09:49:06.982: W/MainActivity(5908): Start Button Pushed



--
 
---
You received this message because you are subscribed to a topic in the Google Groups "javacv" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/javacv/Ku8PzOUMobA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to javacv+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--



Samuel Audet

unread,
Jan 19, 2014, 11:33:36 PM1/19/14
to jav...@googlegroups.com
On 01/20/2014 01:20 PM, Venkata Reddy Nallamilli wrote:
> While i am setting recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264) ;
> I am getting this error.
>
> 01-20 09:49:06.972: W/System.err(5908): com.googlecode.javacv.FrameRecorder$Exception: avcodec_find_encoder() error: Video codec not found.

Which version of JavaCV?

Venkata Reddy Nallamilli

unread,
Jan 19, 2014, 11:44:16 PM1/19/14
to jav...@googlegroups.com
i am using javacv-0.7-bin.zip jar


--

--- You received this message because you are subscribed to a topic in the Google Groups "javacv" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/javacv/Ku8PzOUMobA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to javacv+unsubscribe@googlegroups.com.

Venkata Reddy Nallamilli

unread,
Jan 20, 2014, 1:36:40 AM1/20/14
to jav...@googlegroups.com

Venkata Reddy Nallamilli

unread,
Jan 20, 2014, 7:50:43 AM1/20/14
to jav...@googlegroups.com
Is there any separate android application which will transfer live video of h264 type video from android camera to server? please send me  if any  code is available with you!

Samuel Audet

unread,
Jan 20, 2014, 8:32:15 AM1/20/14
to jav...@googlegroups.com
On 01/20/2014 01:44 PM, Venkata Reddy Nallamilli wrote:
> i am using javacv-0.7-bin.zip jar

That's not possible. The symbol "avutil.PIX_FMT_YUV420P" does not exist
in that version. Please try again with JavaCV 0.7.

Samuel

Samuel Audet

unread,
Jan 20, 2014, 8:34:03 AM1/20/14
to jav...@googlegroups.com
On 01/20/2014 09:50 PM, Venkata Reddy Nallamilli wrote:
> Is there any separate android application which will transfer live video
> of h264 type video from android camera to server? please send me if any
> code is available with you!

The RecordActivity.java sample should do that just fine:
http://code.google.com/p/javacv/source/browse/samples/RecordActivity.java

Samuel

Venkata Reddy Nallamilli

unread,
Jan 21, 2014, 1:27:01 AM1/21/14
to jav...@googlegroups.com
HiSamuel Audet,

Thanq very much,i followed this link  https://code.google.com/p/javacv/  and add this line
 recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);

now working great.

Thanks a lot.


--

--- You received this message because you are subscribed to a topic in the Google Groups "javacv" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/javacv/Ku8PzOUMobA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to javacv+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Martin Veltins

unread,
Jun 19, 2014, 11:19:34 AM6/19/14
to jav...@googlegroups.com
Hi,
I've encountered the very same problem here, but 'till now, I'm unable to solve it ... .
I'm using the same project example as you did: walking-productions.com
and updated javacv/cpp to Version 0.8.

Now, when trying to switch to H.264 Codec, as Samuel suggested, via: recorder.setVideoCodec(AV_CODEC_ID_H264);
Eclipse returns (hovering above that line):

AV_CODEC_ID_H264 cannot be resolved to a variable

why doesn't this work?
Can i replace AV_CODEC_ID_H264 by it's variable?

When trying the same with:

 recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
[ + import org.bytedeco.javacpp.presets.avcodec; ]


AV_CODEC_ID_H264 still does not get resolved.

Any ideas what to do, in order to get it resolved?
If not, where can i find the correct IDs for the usable codecs?

Thanks,
Martin



Am Dienstag, 21. Januar 2014 07:27:01 UTC+1 schrieb Venkata Reddy Nallamilli:
HiSamuel Audet,

Thanq very much,i followed this link  https://code.google.com/p/javacv/  and add this line
 recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);

now working great.

Thanks a lot.
On Mon, Jan 20, 2014 at 7:04 PM, Samuel Audet <samuel...@gmail.com> wrote:
On 01/20/2014 09:50 PM, Venkata Reddy Nallamilli wrote:
Is there any separate android application which will transfer live video
of h264 type video from android camera to server? please send me  if any
  code is available with you!

The RecordActivity.java sample should do that just fine:
http://code.google.com/p/javacv/source/browse/samples/RecordActivity.java

Samuel


--

--- You received this message because you are subscribed to a topic in the Google Groups "javacv" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/javacv/Ku8PzOUMobA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to javacv+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Samuel Audet

unread,
Jun 20, 2014, 8:41:13 AM6/20/14
to jav...@googlegroups.com
Hi,


On 06/20/2014 12:19 AM, Martin Veltins wrote:
 recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
[ + import org.bytedeco.javacpp.presets.avcodec; ]


AV_CODEC_ID_H264 still does not get resolved.

You're going to need to
    import static org.bytedeco.javacpp.avcodec.*;
for that to work!

Samuel

Martin Veltins

unread,
Jun 20, 2014, 1:22:07 PM6/20/14
to jav...@googlegroups.com
:)
thanks, that did help!

Martin
Reply all
Reply to author
Forward
0 new messages