Merging H263 videos

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Merging H263 videos

MatCam
Hi I'm currently trying to merge 2 h263 videos.
When i try to merge them i firstly had only the first video available in the merged version.

So following FAQ of FFMPEG, I tried to use intermediate format to avoid merging problem due to file headers.

After many test here my command  (mpg is my intermediate format, is ts better or faster ?)
ffmpeg.exe -threads 8 -i "1.mpg|2.mpg" -f mpeg -bufsize 1000k -maxrate 5000k -b:v 500k  -vcodec h263 -s 704x576  output.mp4

As you can see I do weird stuff with bitrate and other rates to avoid errors but even when i have no errors my video is empty (good duration but without my video ...)

Could you show me an example of command line to simply merge Two ts (or mpg) files in a h263 one ?

Thanks.

Sincerely
mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Merging H263 videos

Werner Robitza
On Fri, Aug 16, 2013 at 11:36 AM, MatCam
<[hidden email]>wrote:

> Hi I'm currently trying to merge 2 h263 videos.
> When i try to merge them i firstly had only the first video available in
> the
> merged version.
>
> So following FAQ of FFMPEG, I tried to use intermediate format to avoid
> merging problem due to file headers.
>
> After many test here my command  (mpg is my intermediate format, is ts
> better or faster ?)
> ffmpeg.exe -threads 8 -i "1.mpg|2.mpg" -f mpeg -bufsize 1000k -maxrate
> 5000k

-b:v 500k  -vcodec h263 -s 704x576  output.mp4
>

We don't know how you converted your files to .mpg, but "-f mpeg" is wrong
here, because it specifies an MPEG-1 program stream, while the MP4
extension is for MPEG-4 Part 14 containers.
Don't forget that encoding your input videos to MPEG-1 or MPEG-2 will
result in quality degradation. Concatenating them again, and re-encoding
with a bitrate of 500 kBit/s to H.263 will degrade your quality even
further. Even if you got your concatenated video to play, it might look
really bad.


> As you can see I do weird stuff with bitrate and other rates to avoid
> errors
> but even when i have no errors my video is empty (good duration but without
> my video ...)
>

It'd be good if you told us what errors you get, instead of trying to add
various options in order to avoid them. Most ffmpeg conversions should work
"out of the box" without additional options. Maybe you can include the
full, uncut output of the above command. Then we know what material we're
working with here.

Thank you
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Merging H263 videos

Francois Visagie
In reply to this post by MatCam
> -----Original Message-----
> From: [hidden email] [mailto:ffmpeg-user-
> [hidden email]] On Behalf Of MatCam
> Sent: 16 August 2013 11:36
> To: [hidden email]
> Subject: [FFmpeg-user] Merging H263 videos
>
> Hi I'm currently trying to merge 2 h263 videos.
> When i try to merge them i firstly had only the first video available in
the
> merged version.
>
> So following FAQ of FFMPEG, I tried to use intermediate format to avoid
> merging problem due to file headers.
>
> After many test here my command  (mpg is my intermediate format, is ts
> better or faster ?) ffmpeg.exe -threads 8 -i "1.mpg|2.mpg" -f mpeg
-bufsize
> 1000k -maxrate 5000k -b:v 500k  -vcodec h263 -s 704x576  output.mp4

The syntax you're using here seems similar to that of the physical concat
protocol (http://www.ffmpeg.org/ffmpeg-all.html#concat-3) but not quite
correct (more precisely, I've never tried using it without the preceding
'concat:'. The physical concatenation protocol is IMO not the correct
mechanism to use here in any event, since as far as I can work out it does a
byte-level concatenation, which works for things like DVD VOB files.

In this case of separately muxed input files, headers will likely create
problems with physical concatenation as you point out. A more suitable
mechanism to try would be the virtual concatenation script demuxer
(http://www.ffmpeg.org/ffmpeg-all.html#concat-1). This demuxer seems to
operate at the packet level, hence one would expect header information to be
removed from the concatenation. The concat filter
(http://www.ffmpeg.org/ffmpeg-all.html#concat-2) may also be worth a look
although it seems more involved to set up and maintaining sync might become
an issue.

>
> As you can see I do weird stuff with bitrate and other rates to avoid
errors
> but even when i have no errors my video is empty (good duration but
> without my video ...)

As pointed out elsewhere it's wrong to use the '-f mpeg' option with MP4
output. Since ffmpeg will correctly guess the intended output format from
the .mp4 file extension, you can just omit the '-f' option altogether. If
other problems remain afterwards, post your command line and full console
output.

>
> Could you show me an example of command line to simply merge Two ts (or
> mpg) files in a h263 one ?
>
> Thanks.
>
> Sincerely
> mathieu
>
>
>
> --
> View this message in context: http://ffmpeg-
> users.933282.n4.nabble.com/Merging-H263-videos-tp4660745.html
> Sent from the FFmpeg-users mailing list archive at Nabble.com.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Merging H263 videos

MatCam
Thanks for both responses !

I'm agree, trying to solve problem by adding more and more properties to my request to ffmpeg is not the best way to successfully make my video...

So if I understand, using TS will avoid loss of quality ?
so my first step is to follow instruction to concat 2 h264 video in one using TS:

D:\ffmpeg-20130813-git-bbbd959-win64-static\bin>ffmpeg.exe -i D:\Records\2013-08-16_084044\Source\2013-08-16_084044.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts

ffmpeg version N-55515-gbbbd959 Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug 13 2013 18:06:32 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblu
ray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-lib
vpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 42.100 / 52. 42.100
  libavcodec     55. 27.100 / 55. 27.100
  libavformat    55. 13.102 / 55. 13.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.100 /  3. 82.100
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Records\2013-08-16_084044\Source\2013-08-16_084044.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf54.31.100
  Duration: 00:00:05.07, start: 0.000000, bitrate: 5476 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5390 kb/s, 50 fps, 50 tbr, 12800 tbn, 50 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      handler_name    : SoundHandler
Output #0, mpegts, to 'intermediate1.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.13.102
    Stream #0:0(und): Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 5390 kb/s, 50 fps, 90k tbn, 50 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, 128 kb/s
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[NULL @ 0000000004e20620] Warning: SPS NALU missing or invalid. The resulting stream may not play.
[NULL @ 0000000004e20620] Warning: PPS NALU missing or invalid. The resulting stream may not play.
Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument
[adts @ 000000000251c360] Encoder did not produce proper pts, making some up.
frame=  251 fps=0.0 q=-1.0 Lsize=    3632kB time=00:00:05.07 bitrate=5859.8kbits/s
video:3303kB audio:79kB subtitle:0 global headers:0kB muxing overhead 7.365148%

here is my first problem.

Secondly, what are the parameter i have to use to make the same in h263 ?
is there a filter h264_mp4toannexb for h263 for making the same to concat files ?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Merging H263 videos

MatCam
Hi,

I'm stuck since my last message.

My system do not permit me to execute script so i'm forced to only use ffmpeg command line.

Could you help me to find a way to transcript h263 file to ts file and then merge it back in a h263 file ?

Thanks !