bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.45k stars 1.57k forks source link

Error occurred when recording from flv video stream to mp4 #2033

Closed Snow-Chen closed 1 year ago

Snow-Chen commented 1 year ago

when i use FFmpegFrameRecorder record video from flv, and try to save video as mp4 format, unfortually the mp4 file can not play succeessly when i run commad "ffmpeg -i hello.mp4", there is error like this: [mov,mp4,m4a,3gp,3g2,mj2 @ 0000019b4822d740] moov atom not found

image

saudet commented 1 year ago

You'll need to make sure FFmpegFrameRecoder.stop() gets called.

Snow-Chen commented 1 year ago

You'll need to make sure FFmpegFrameRecoder.stop() gets called.

yes,I do call FFmpegFrameRecorder.stop() image image

There are other possible reasons cause this problem?

saudet commented 1 year ago

Make sure you're not using OutputStream, the mp4 format doesn't support streams well.

Snow-Chen commented 1 year ago

Make sure you're not using OutputStream, the mp4 format doesn't support streams well.

almost all the video format except avi can not work,I have tried mp4 wmv flv I use FFmpegFrameGrabber to grabber frame from flv stream address like "http://xxx.flv” then try to record frame and save to local mp4 file by FFmpegFrameRecoder

FFmpegFrameRecorder(String filename, int imageWidth, int imageHeight, int audioChannels)

Isn't that supported?

Snow-Chen commented 1 year ago

hi saudet, thank you for your help. I've found out the reason for the failture. It's my mistake. FFmpegFrameRecoder.stop() should be called before FFmpegFrameRecoder.release()