Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
ffmpeg keeps getting killed (I think by my OS)
21 octobre 2013, par Adi UliciI am using ffmpeg to convert video files on a website. The process goes like this:
- a user uploads a video file
- a cron job runs over a PHP file which calls ffmpeg and tells it to convert and resize the given video
- ffmpeg suddenly gets closed and doesn't finishes it's process, ending with corrupt video file
The command that I use to convert the file goes like this:
/usr/local/bin/ffmpeg -i 'input' -s 1280x720 -acodec libfaac -b:a 128k -vcodec libx264 -b:v 3000k -flags +aic+mv4 'output'
I set a cron email and all I get is this:
sh: line 1: 25173 Killed /usr/local/bin/ffmpeg -i '/home ....
.Is there a way to stop the OS to kill my process? Or a way to find out why does it kill it? Strangely, it doesn't do it all the time, only about 50% of the time.
I also tried running the command as a root through ssh. As a root I didn't manage to make the OS to kill ffmpeg, no matter how many times I tried running it.
-
Windows libs for ffmpeg don't link (visual studio) ?
21 octobre 2013, par Chad MourningSo, I'm trying to get a project I'm writing to link against ffmpeg libraries but I keep getting linker errors:
1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "struct AVCodec * __cdecl avcodec_find_encoder(enum AVCodecID)" (?avcodec_find_encoder@@YAPEAUAVCodec@@W4AVCodecID@@@Z) 1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "int __cdecl av_dict_set(struct AVDictionary * *,char const *,char const *,int)" (?av_dict_set@@YAHPEAPEAUAVDictionary@@PEBD1H@Z) 1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "int __cdecl avcodec_encode_video(struct AVCodecContext *,unsigned char *,int,struct AVFrame const *)" (?avcodec_encode_video@@YAHPEAUAVCodecContext@@PEAEHPEBUAVFrame@@@Z) 1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "struct AVCodecContext * __cdecl avcodec_alloc_context3(struct AVCodec const *)" (?avcodec_alloc_context3@@YAPEAUAVCodecContext@@PEBUAVCodec@@@Z) 1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "struct AVFrame * __cdecl avcodec_alloc_frame(void)" (?avcodec_alloc_frame@@YAPEAUAVFrame@@XZ) 1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "void __cdecl av_free(void *)" (?av_free@@YAXPEAX@Z) 1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "int __cdecl avcodec_open2(struct AVCodecContext *,struct AVCodec const *,struct AVDictionary * *)" (?avcodec_open2@@YAHPEAUAVCodecContext@@PEBUAVCodec@@PEAPEAUAVDictionary@@@Z) 1>GLViewLASReader.obj : error LNK2001: unresolved external symbol "int __cdecl avcodec_close(struct AVCodecContext *)" (?avcodec_close@@YAHPEAUAVCodecContext@@@Z) 1>C:\STEAMiE\usr\modules\LASReader\win32\Release\LASReader.exe : fatal error LNK1120: 8 unresolved externals
I downloaded the dev package from:
http://ffmpeg.zeranoe.com/builds/
But when I link against the libs like I normally would, I get the linker errors. Is this package somehow different from every other library I've tried to use that I just need the .h/.libs for? Is there a reason why it has to be that way?
-
how to use guardianproject's android ffmpeg library ?
21 octobre 2013, par Blaze TamaFirst, this is my first time "playing" with ffmpeg, so please bear with me.
Generally, i dont understand ffmpeg even a little bit. So i did lot, lot of researches (and also trial & error) and i finally found this project and its library
So i was successfully created the ffmpeg and sox binary file, and i put it in the raw folder at the library project (from the link i shared).
Now, i want to use the library for my project, but i still cant do it. I tried to use some methods in the
FfmpegController
likecombineAudioAndVideo
and more but its not working (yet).I dont post the error here since i still do my trial&errors (and the error change regularly) but im getting tired now.
EDIT
This is what i did :
private FfmpegController ffController; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); File file = new File(Uri.parse("android.resource://com.my.package/" + R.raw.test).getPath()); try { ffController = new FfmpegController(this, file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } MediaDesc desc = ffController.combineAudioAndVideo(R.raw.test, R.raw.musictest, "test.mp4", null); }
The
combineAudioAndVideo
always error because wrong parameters. It needsMediaDesc
but i dont know how to do it.I will be very happy if you can share your working code if you have done the ffmpeg processing with this library.
-
How to synchronize audio and video using ffmpeg libraries ?
21 octobre 2013, par jsp99Stuck writing a very basic media player in C, using SDL and ffmpeg libraries. Initially, followed the theory in this page to get an idea about the entire program and the usage of libraries. After coding from scratch, thanks to that tutorial and many other resources, finally I made my code work, using the latest libraries of ffmpeg and SDL (2.0). But my code lacks a proper synchronization mechanism (actually it lacks a sync mechanism !).
I still don't have a clear idea on how to synchronize the audio and video together as the theory provided in the link is only very partially correct (atleast when it comes to using the latest dev libraries).
For example, a sentence in this page is as follows :However, ffmpeg reorders the packets so that the DTS of the packet being processed by avcodec_decode_video() will always be the same as the PTS of the frame it returns.
I am using avcodec_decode_video2() and the DTS of the packet is definitely not the same as pts of the frame it decodes (in general).
I read this very informative BBC report and it makes complete sense. I have a clear idea about PTS and DTS. But the PTS and DTS values that ffmpeg is using for packets and decoded frames is confusing. I wish there were some documentation on that aspect.
Can someone explain the steps to synchronize audio and video ? I only need the steps. I am quite comfortable implementing them. Any help is greatly appreciated. Thanks !
PS : Here's a screenshot of what I am talking about :
The huge negative value is, I assume AV_NOPTS_VALUE.
-
FFMpeg creates MP4 which no browser can decode, but it can be played in VLC
21 octobre 2013, par wvxvwHow can I debug what happened? I've tried this with variations to generate a short video from a single image:
ffmpeg -loop 1 -i black.png -vcodec libx264 -b 1500k -s 640x360 -t 1 out.mp4
tried:
- Changing aspect ration (or omitting it).
- using
-image2
instead of-loop
. - omitting bitrate.
- creating longer videos.
- also tried different syntax for specifying video codec:
-v:c libx264
. - tried mpeg instead of libx264.
In every case the effect is the same. The video plays in VLC, but not in the browser.