Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
NSTask and FFMpeg losing output
16 novembre 2011, par MorganI'm trying to call ffmpeg from NSTask in objective-c. I execute the ffmpeg command in terminal and it works flawlessly every time. I make the same command using NSTask, and it never gives me the whole output. It cuts it off half way through the output, at a seemingly random spot every time. Here is my code.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSString* ffmpegPath = [[NSBundle mainBundle] pathForResource:@"ffmpeg" ofType:@""]; NSString* path = @"test.mov"; NSTask *task = [[NSTask alloc] init]; NSArray *arguments = [NSArray arrayWithObjects: @"-i", path, nil]; NSPipe *pipe = [NSPipe pipe]; NSFileHandle * read = [pipe fileHandleForReading]; [task setLaunchPath: ffmpegPath]; [task setArguments: arguments]; [task setStandardOutput: pipe]; [task launch]; [task waitUntilExit]; NSData* data = [read readDataToEndOfFile]; NSString* stringOutput = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"%@", stringOutput); NSLog(@"%i", [task terminationStatus]); NSLog(@"DONE"); }
-
WMV Converter Fails FFMpeg
15 novembre 2011, par zomercI just cann't seem to get the FFMpeg working with using the library. Everytime I try to convert asf file to wmv. I get the following issue on run time:
[wmv1 @ 0x81ee000]error, slice code was 2 [wmv1 @ 0x81ee000]header damaged
This my code:
static void audio_decode_example(const char *outfilename, const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; int out_size, len, in_size; FILE *f, *outfile; uint8_t *outbuf; uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; AVPacket avpkt; av_init_packet(&avpkt); printf("Audio decoding\n"); /* find the mpeg audio decoder */ codec = avcodec_find_decoder(CODEC_ID_WMV1); if (!codec) { fprintf(stderr, "codec not found\n"); return; } c= avcodec_alloc_context2(CODEC_TYPE_AUDIO); /* open it */ if (avcodec_open(c, codec) < 0) { fprintf(stderr, "could not open codec\n"); return; } outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE); f = fopen(filename, "rb"); if (!f) { fprintf(stderr, "could not open %s\n", filename); return; } outfile = fopen(outfilename, "wb"); if (!outfile) { av_free(c); return; } /* decode until eof */ avpkt.data = inbuf; len = avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); NSLog(@"%d", avpkt.size); while (avpkt.size > 0) { out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; len = avcodec_decode_audio2(c, (short *)outbuf, &out_size, inbuf,len);// avpkt.size); NSLog(@"%d", len); if (len < 0) { fprintf(stderr, "Error while decoding\n"); fclose(outfile); return; } if (out_size > 0) { /* if a frame has been decoded, output it */ fwrite(outbuf, 1, out_size, outfile); } avpkt.size -= len; avpkt.data += len; if (avpkt.size < AUDIO_REFILL_THRESH) { /* Refill the input buffer, to avoid trying to decode * incomplete frames. Instead of this, one could also use * a parser, or use a proper container format through * libavformat. */ memmove(inbuf, avpkt.data, avpkt.size); avpkt.data = inbuf; len = fread(avpkt.data + avpkt.size, 1, INBUF_SIZE - avpkt.size, f); if (len > 0) avpkt.size += len; } } fclose(outfile); fclose(f); free(outbuf); avcodec_close(c); av_free(c); }
I have try the command line utilities and it successfully convert the file. Any help would be helpfully. thanks
-
Calling ffmpeg convert from bash in iOS ?
15 novembre 2011, par guoxjI can use something like
ffmpeg -f mpeg -i src.mpg mpeg4 dest.mp4
to convert src.mpg to dest.mp4 in bash. And I have to port ffmpeg to iOS. How can I use the command in iOS to complete the convert? -
How to determine linux version on server [migrated]
15 novembre 2011, par chetanI purchased a web server recently and have got access to shell on it.Want to install ffmpeg extension on it but I dont know the linux version on the server. I am not used to running linux commands, so can anybody help me in determining the linux version using the shell commands.
-
DirectShow / x264 / AviSynth and Windows Server 2008 SP2
15 novembre 2011, par TimI'm having a hard time getting AviSynth to open video files on Windows Server 2008 SP2 (32 bit). I'm aware of the sound card issue, right now I'm using Audio=false. I've tried installing the below, but I always get the error "No combination of filters could be found to render the stream". I'm using DirectShowSource, but I don't have to ... I'm open that can open most formats your average Windows 7 machine can handle.
I've installed:
- "Desktop Extensions" - which installed Media Player and codecs
- haali media splitter and ffdshow
- Windows Media Services (for streaming, this supposedly had the mpeg codecs, but it doesn't) Windows Essentials Media Codec Pack
- K-Lite Codec Pack Full VLC
- QuickTime Tried copying mpeg.dll codecs from 32 bit Windows 7 to Server and regsvr32'ing them, but get error
- Tried copying *.AX filters from 32 bit Windows 7 to server and regsvr32'ing, but still get AVS error
AVS Script:
- video0 = DirectShowSource("video0.avi", fps=30, pixel_type="RGB24", Audio=false)
- video1 = DirectShowSource("video1.avi", fps=30, pixel_type="RGB24", Audio=false)
- Dissolve(video0, video1, 30)
Command Line:
- x264 test.avs -o test.mp4 --bframes 3 --ref 3 --vbv-maxrate 2500 --vbv-bufsize=25000 --level 40 --threads
AVS Error:
- avs [error]: "No combination of filters could be found to render the stream"
Has anyone gotten this working on Windows Server? If so what filters codecs or other setup do I need?
Thank you for the time.