Audio/video stream recording forums

Attention Visitor:
You may have to register or log in before you can post:
  • Click the register link to sign up.
  • Registered members please fill in the form below and click the "Log in" button.
To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Audio/video stream recording forums > Streaming media recording forum > rtmpdump
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #31  
Old 01-01-2013, 06:53 PM
TubeDigger TubeDigger is offline
Senior Member
 
Join Date: Jun 2011
Posts: 134
TubeDigger is on a distinguished road
Default

Re: FLV fixer script


Slightly improved Yet Another FLV Fixer: C file and compiled binary.
Reply With Quote
  #32  
Old 01-02-2013, 10:03 AM
reumb reumb is offline
Junior Member
 
Join Date: Jul 2011
Posts: 13
reumb is on a distinguished road
Default

Re: FLV fixer script


Thanks for the update TubeDigger

Best flvfixer ever made for windows noobs/pros (in my opinion)

just drag/drop your flv f4v on yaflvfix.exe
Reply With Quote
  #33  
Old 01-20-2013, 12:44 AM
grobatob grobatob is offline
Junior Member
 
Join Date: Jan 2013
Posts: 2
grobatob is on a distinguished road
Default

Re: FLV fixer script


Hi, I have a problem that I suppose most people don't have because I have "broken" the file I need fixed myself.

The problem is I have a series of flv files dumped with rtmpdump that I want to merge, which have identical video/audio streams with overlap so they can't simply be connected one after the other. (That is for example file1 goes from 0-1hr file2 goes 45mins to 2 hours, etc) I have linux so I am unable to try most of the merging tools I found with a google search, but avconv and ffdshow both seem to be unable to do it.

The files all have identical video/audio streams and since they overlap I went and found a spot they are the same in a hex editor and simply used dd to trim them then cat to join them together. Once concatenated together the playback is perfect and seamless in the version of mplayer2 I have installed (2.1~git20120828.28228-1) from start to end, however it doesn't show total play time and the OSD time jumps backwards when it hits the join point in the files with the message:

Code:
Decreasing video pts: 4.743000 < 50.986000
Playing the same file in VLC causes a large skip, presumably VLC is skipping ahead to the next point in the file where the pts is greater than the last one it played.

I was hoping these concatenated files could simply be run through ffmpeg with '-codec copy' but when ffmpeg (most recent compiled from their git) gets to the join it gives a series of errors like this:

Code:
[flv @ 0x204cba0] st:0 PTS: 41471 DTS: 41471 < 50991 invalid, clipping
The resulting file has the wrong total time, and when it gets to the join the video skips ahead a fair bit (in mplayer2) then the video ends early while the audio continues to play without any skip and goes its full length. VLC behaves the same as it did before running the file through ffmpeg

So I have been searching around trying to figure out how to fix the timestamps. Presumably they just need to be resequenced so they line up as they should. I looked at the ffmpeg source code where the 'invalid, clipping' message is to see if I could edit it to adjust the timestamps instead of clipping but it is quite a bit over my head.

So that is what brings me here. I have tried both the php script and compiled the latest yaflvfix.c which works fine on linux. The php script gives weird artefacting at the join which other attempts to fix haven't and the same large skip/too short video playback. The yaflvfix program gives seemingly identical results to ffmpeg, but the source code is a lot easier to understand so I think it is the closest I have gotten to fixing this problem.

Now I am trying to work from the yaflvfix source to see if I can edit it to meet my needs, but I was hoping someone could help me as I am completely clueless about all of this. Maybe someone could do it very easily, whereas for me it is very difficult. I know nothing about video streams or editing them at all.

Here is a 12000682 byte sample clip showing my problem. The first 6000000 bytes are from the first video file and contain the unmodified header, the last 6000682 bytes are from the second file which I need to join and of course are taken from the middle of some video/audio data which is identical in both files. This isn't exactly where I need to merge them but is the shortest clip I could make where they overlap. The actual files are much larger.

http://www.mediafire.com/?y2h9o6dml11kaz1

Any assistance people could give with fixing this would be greatly appreciated. If the yaflvfix.c program can be modified to handle this type of file I think that seems most promising right now. As I said this file plays flawlessly in a recent mplayer2 build so there is no video or audio corruption at all, it appears to be entirely a problem with timestamps and how various software deals with the timestamps.

Thank you for reading, and thank you for any help you can give.
Reply With Quote
  #34  
Old 01-20-2013, 11:13 AM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: FLV fixer script


@grobatob

Try this one:
http://pastebin.com/NHCE3c3f
Reply With Quote
  #35  
Old 01-20-2013, 07:32 PM
grobatob grobatob is offline
Junior Member
 
Join Date: Jan 2013
Posts: 2
grobatob is on a distinguished road
Default

Re: FLV fixer script


Quote:
Originally Posted by KSV View Post
@grobatob

Try this one:
http://pastebin.com/NHCE3c3f
Wow, thank you so much this seems to work exactly as I had needed! I only tried it on that sample file and a larger one with a single "seam" for now but it does exactly what I had hoped for! I can even now run it through ffmpeg without error to losslessly remux as mp4. Great!

I will try it on a much larger file soon with several "seams" and let you know how it goes, but I anticipate it would work fine. At any rate I could probably just join one file at a time then run the fix after each join if needed.

Will these changes eventually be merged into the main script you host on github, or is it something too custom and alters the behaviour in a way that it no longer works for other files it was originally intended for?

Thanks again. You fixed it so fast when I had been struggling with it for a long time. Your work is very much appreciated.
Reply With Quote
  #36  
Old 01-21-2013, 05:22 AM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: FLV fixer script


i have pushed the update to the repo. hopefully it wouldn't break any previous functionality. before reporting any problem with any of my scripts make sure you are using the latest version of the script from repo.
Reply With Quote
  #37  
Old 03-02-2013, 08:38 AM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: FLV fixer script


Changes:

Code:
1. improved performance of FlvFixer
Batch file for drag and drop functionality:
Code:
@echo off
title KSV FlvFixer Script

rem == Set input output filenames ==
set IN_FILE="%~dpnx1"
set OUT_FILE="%~dpn1_fixed.flv"

rem == Change current directory ==
cd "%~dp0"
cd %~d0

php FlvFixer.php --in %IN_FILE% --out %OUT_FILE% --debug --nometa 2> Debug.txt
Reply With Quote
  #38  
Old 03-02-2013, 02:15 PM
Mary Chris Smith Mary Chris Smith is offline
Junior Member
 
Join Date: Mar 2013
Posts: 3
Mary Chris Smith is on a distinguished road
Default

Re: FLV fixer script


Hey KSV,
I want to fix a FLV file which rtmpdump (live stream) generated.
I get the following error:
Code:
FlvFixer.php --debug --nometa --in foo.flv --out bar.flv
Code:
                                 KSV FLV Fixer

 Type    CurrentTS       PreviousTS      Size    Position        
 VIDEO   0               -1              15641   13              
Fixing video timestamp
 VIDEO   0               0               7796    
 VIDEO   8               0               7796    15669           
Fixing video timestamp
 VIDEO   0               8               9197    
 VIDEO   16              8               9197    23480           
Fixing video timestamp
 VIDEO   0               16              7792    
 VIDEO   24              16              7792    32692           
Fixing video timestamp
 VIDEO   0               24              8003    
 VIDEO   32              24              8003    40499           
Fixing video timestamp
 VIDEO   0               32              7762    
 VIDEO   40              32              7762    48517           
Fixing video timestamp
 VIDEO   0               40              9007    
 VIDEO   48              40              9007    56294           
Fixing video timestamp
 VIDEO   0               48              7926    
 VIDEO   56              48              7926    65316           
Fixing video timestamp
 VIDEO   0               56              9196    
 VIDEO   64              56              9196    73257           
Fixing video timestamp
 VIDEO   0               64              421     
 VIDEO   72              64              421     82468           
Fixing video timestamp
 VIDEO   0               72              7848    
 VIDEO   80              72              7848    82904           
Fixing video timestamp
 VIDEO   0               80              7474    
 VIDEO   88              80              7474    90767           
Fixing video timestamp
 VIDEO   0               88              8066    
 VIDEO   96              88              8066    98256           
Fixing video timestamp
 VIDEO   0               96              7232    
 VIDEO   104             96              7232    106337          
Fixing video timestamp
 VIDEO   0               104             8107    
 VIDEO   112             104             8107    113584          
Fixing video timestamp
 VIDEO   0               112             7724    
 VIDEO   120             112             7724    121706          
Broken FLV tag encountered! Aborting further processing.
Processed input file in 0.06 seconds
Finished
Reply With Quote
  #39  
Old 03-03-2013, 12:52 AM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: FLV fixer script


@Mary Chris Smith

Well script isn't lying. rtmpdump actually saved the corrupt file. it's a known bug in official version which i fixed ages ago. you need to use my version of rtmpdump to save the proper file in such cases. if you wanna recover the already saved files you have to fix them first by hand.
Reply With Quote
  #40  
Old 03-03-2013, 12:29 PM
Mary Chris Smith Mary Chris Smith is offline
Junior Member
 
Join Date: Mar 2013
Posts: 3
Mary Chris Smith is on a distinguished road
Default

Re: FLV fixer script


Quote:
Originally Posted by KSV View Post
@Mary Chris Smith

Well script isn't lying. rtmpdump actually saved the corrupt file. it's a known bug in official version which i fixed ages ago. you need to use my version of rtmpdump to save the proper file in such cases. if you wanna recover the already saved files you have to fix them first by hand.
Ok, I'll try your version, thanks!
Reply With Quote
Reply Post New Thread
Tags:



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 05:41 PM.


Powered by All-streaming-media.com; 2006-2011
vB forum hacked with Zoints add-ons