leandromoreira / ffmpeg-libav-tutorial

FFmpeg libav tutorial - learn how media works from basic to transmuxing, transcoding and more. Translations: 🇺🇸 🇨🇳 🇰🇷 🇪🇸 🇻🇳 🇧🇷
https://github.com/leandromoreira/ffmpeg-libav-tutorial
BSD 3-Clause "New" or "Revised" License
9.82k stars 941 forks source link

LOG: ERROR could not open the file #38

Closed VenkateswaranJ closed 4 years ago

VenkateswaranJ commented 5 years ago

Hi,

I have compiled your code and try to open the example mp4 file (bbb_sunflower_1080p_60fps_normal.mp4), but it shows below error.

LOG: initializing all the containers, codecs and protocols. LOG: opening the input file (bbb_sunflower_1080p_60fps_normal.mp4) and loading format (container) header LOG: ERROR could not open the file.

I tried with different file but no success. Is it problem with new send/receive API.?

Regards, Venkateswaran

leandromoreira commented 5 years ago

are you using the dockerized version ? if you try with make run_hello does it work?

VenkateswaranJ commented 5 years ago

Hi Leandro,

I think you have updated your code for FFmpeg version 4, which doesn't require av_register_all(). Unfortunately, I'm using 3.4.4 and I have added av_register_all() before av format context creation and it's working fine now.

Really appreciate your effort for making this tutorial.

YuriTu commented 4 years ago

@leandromoreira I am using the dockerized version. but I have the same error.Could you give me any advice? thx

docker run -w /files --rm -it  -v `pwd`:/files leandromoreira/ffmpeg-devel \
      gcc -L/opt/ffmpeg/lib -I/opt/ffmpeg/include/ /files/0_hello_world.c \
      -lavcodec -lavformat -lavfilter -lavdevice -lswresample -lswscale -lavutil \
      -o /files/build/hello
docker run -w /files --rm -it -v `pwd`:/files leandromoreira/ffmpeg-devel /files/build/hello /files/small_bunny_1080p_60fps.mp4
LOG: initializing all the containers, codecs and protocols.
LOG: opening the input file (/files/small_bunny_1080p_60fps.mp4) and loading format (container) header
LOG: ERROR could not open the file
make: *** [run_hello] Error 255
YuriTu commented 4 years ago

Finally I found the reason. mp4 file did't exit with docker image. There is a local mapping of file path .

can execute the script

wget -O bunny_1080p_60fps.mp4 http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4
ffmpeg -y -i bunny_1080p_60fps.mp4 -ss 00:01:24 -t 00:00:10 small_bunny_1080p_60fps.mp4

then make run_hello
It's work at last

hanrell commented 4 years ago

Como posso abrir um arquivo local ao invés de usar docker?

leandromoreira commented 4 years ago

@hanrell mesmo usando docker você pode usar um arquivo local e mapea-lo pro docker (veja o makefile), o uso do docker é pra facilitar o desenvolvimento visto a necessidade de se ter as libs mas você pode rodar localmente dá uma olhada no makefile, ficará mais claro.