I have a problem with incorrect value of frame rate in output file, after converting. I made a really simple example to describe a problem:
public static void main(String[] args) {
// reader
IMediaReader reader = ToolFactory.makeReader("/tmp/1/i3.avi");
IMediaWriter writer = ToolFactory.makeWriter("/tmp/1/o3.mp4", reader);
reader.addListener(writer);
while (true) {
try {
final IError error = reader.readPacket();
if(error != null) {
System.err.println("Error decoding packet " + error.getDescription());
if (!reader.isOpen()) {
break;
}
}
} catch (final Exception ex) {
System.err.println("Error decoding packet " + ex.getMessage());
if (!reader.isOpen()) {
break;
}
}
}
}
Any additional parameters for video or audio streams/codecs aren't configured .
The input video file ("/tmp/1/i3.avi") has the following features:
- General
- Container: Audio Video Interleave (AVI)
- Video
- Dimensions: 624x352
- Codec: XVID MPEG-4
- Framerate: 24 frames per second
- Bitrate: N/A
- Audio:
- Codec: MPEG-1 Layer 3 (MP3)
- Channels: Stereo
- Sample rate: 48000 Hz
- Bitrate: 112 kbps
The output video file ("/tmp/1/o3.avi") has the following features:
- General
- Container: Quicktime
- Video
- Dimensions: 624x352
- Codec: H.264
- Framerate: 8 frames per second
- Bitrate: 378 kbps
- Audio:
- Codec: MPEG-4 AAC
- Channels: Stereo
- Sample rate: 48000 Hz
- Bitrate: 127 kbps
So, the frame rate in output file is 8 instead of 24. How can I fix it? Please, help me..
PS: I've already tried Xuggler H264 FPS encoding issue and few another solutions, it doesn't help..
UPD: After a long war with Xugler I wrote my own pure-java interface to the avconv and it works fine for me: https://github.com/vbauer/avconv4java