Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
grep on a running terminal buffer
25 décembre 2013, par killerI did ffmpeg -i file.mp4 -y file.mp3 2>&1 | grep "time=" , but it seems that grep shows output only on completion of ffmpeg command, so how could i grep here ,I will later need to save this value of time in a variable every second
-
Find GOP size for mpeg4 video file
25 décembre 2013, par user2922938I am working on mpeg4 video file and I'm using AForge.Video.FFMPEG to extract all frames in video as bitmap images, i use container .mp4 coded with mpeg4.
I need to use only I-frame for each GOP, is there any method or location to find the GOP in mpeg4 use C#?
-
FFMPEG libraries : Bitstream "h264_mp4toannexb" filter does not work
25 décembre 2013, par user2677612We are using
FFmpeg
libraries git-ee94362libavformat
v55.2.100. Our purpose is to mux two streams (video and audio) into M3U8 playlist using HLS.We are using
AV_CODEC_ID_H264
output encoder,AV_PIX_FMT_YUV420P
output video pixel format andCODEC_FLAG_GLOBAL_HEADER
flag for the encoder.The last causes us to use "h264_mp4toannexb" bit stream filter.
So, here is the code snippet:
AVPacket outpkt = {0}; int isGotVideoPacket = 0; av_init_packet(&outpkt); out_video_frame->pts = (int64_t) (video_frame_count * in_video_frame_duration / av_q2d(out_video_stream->time_base)); int ret = avcodec_encode_video2(enc_out_video_ctx, &outpkt, out_video_frame[i], &isGotVideoPacket); assert(0 <= ret); if ((1 == isGotVideoPacket) && (0 < outpkt.size)) { AVPacket new_outpkt = outpkt; if ((AVBitStreamFilterContext*) 0 != vbsf_ctx) { AVPacket new_outpkt = outpkt; ret = av_bitstream_filter_filter(vbsf_ctx, enc_out_video_ctx, (const char*)0, &new_outpkt.data, &new_outpkt.size, outpkt.data, outpkt.size, outpkt.flags & AV_PKT_FLAG_KEY); if (ret > 0) { outpkt = new_outpkt; } else { // We get ret = -22 char errbuf[128] = ""; // Both the functions get "Error number -22 occurred" that don't explain anything av_strerror (ret, errbuf, 128); av_make_error_string (errbuf, 128, ret); } assert(0 <= ret); } outpkt->stream_index = output_video_stream->index; // If to comment av_bitstream_filter_filter() and "if-else", then // At frame #37 we get the following error from av_interleaved_write_frame(): // [mpegts @ 09628140] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb). ret = av_interleaved_write_frame(ofmt_ctx, &outpkt); assert(0 <= ret); }
Our questions:
1. What is the meaning of the "-22" error from av_bitstream_filter_filter()? 2. Where can we get full FFMPEG error code description list? 3. If we are using av_bitstream_filter_filter() right? If no, what is the right way?
Andrey Mochenov.
-
how to seek mp3 in ffmpeg
25 décembre 2013, par user2361120can any one know how to seek mp3 using ffmpeg.I already wasted one week on it.
JNIEXPORT void JNICALL Java_com_music_MainActivity_seek (JNIEnv *env, jobject obj, jint value,jint flag) { int seek_target=(int64_t)(value) *(int64_t)AV_TIME_BASE; //int seek_target=value; seek_target= av_rescale_q(seek_target, AV_TIME_BASE_Q, fmt_ctx- >streams[audio_stream_index]->time_base); // LOGS("seek_target=%lld-------value = %d",seek_target,value); // LOGS("Stage %d",fmt_ctx->streams[audio_stream_index]->time_base); if(flag>0) { av_seek_frame(fmt_ctx, audio_stream_index, seek_target, AVSEEK_FLAG_BACKWARD); avcodec_flush_buffers(dec_ctx); } else { av_seek_frame(fmt_ctx, audio_stream_index, seek_target,AVSEEK_FLAG_ANY); avcodec_flush_buffers(dec_ctx); }
}
can any one know how to seek mp3 using ffmpeg.I already wasted one week on it.
-
Can we execute ffmpeg on MapReduce task (java)on HDFS
25 décembre 2013, par Karn_wayI have a video file on hdfs . i want to create images from the video . can i use ffmpeg or any other solution to do this. Thanks